Awn

Libawn event propagation

Bug #131547 reported by Timon_and_Pumba on 2007-08-10
2
Affects Status Importance Assigned to Milestone
Awn
Medium
Miika-Petteri Matikainen

Bug Description

While creating the stack applet, I did not receive the key-press and expose events.
This fixed the problem:

=== modified file 'libawn/awn-applet-dialog.c'
--- libawn/awn-applet-dialog.c 2007-08-04 16:41:17 +0000
+++ libawn/awn-applet-dialog.c 2007-08-10 12:31:29 +0000
@@ -25,6 +25,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>

 #include "awn-applet.h"
 #include "awn-applet-gconf.h"
@@ -127,12 +128,13 @@
 }

-
+// Should "reposition" dialog-arrow if the dialog does not fit (fall-off-screen)
+// on the desired place.
 void
 awn_applet_dialog_position_reset (AwnAppletDialog *dialog)
 {
- if (dialog->applet == NULL)
- return;
+ if (dialog->applet == NULL)
+ return;

  gint width, height;
  GtkWindow *window = GTK_WINDOW (dialog);
@@ -143,11 +145,12 @@
  /* offest by applet height */
  gtk_widget_get_size_request (GTK_WIDGET(dialog->applet), &width, &height);
  y += height;
+ x += (width / 2) - 36; // gap

  /* offset dialog height */
  gtk_window_get_size (window, &width, &height);
  y -= height;
-
+
  gtk_window_move (GTK_WINDOW(window), x, y-1);
 }

@@ -161,8 +164,9 @@
 _on_expose_event(GtkWidget *widget, GdkEventExpose *expose, gpointer *data)
 {
  cairo_t *cr = NULL;
+ GtkWidget *child = NULL;
  gint width, height;
- const gchar *text;
+ const gchar *text;

  cr = gdk_cairo_create (widget->window);
  if (!cr)
@@ -212,12 +216,12 @@
  // Clean up
  cairo_destroy (cr);

- /* Propagate the expose event to the child */
- gtk_container_propagate_expose (GTK_CONTAINER (widget),
- gtk_bin_get_child (GTK_BIN (widget)),
- expose);
-
- return TRUE;
+ /* Propagate the signal */
+ child = gtk_bin_get_child (GTK_BIN (widget));
+ if (child)
+ gtk_container_propagate_expose (GTK_CONTAINER (widget), child, expose);
+
+ return FALSE;
 }

@@ -225,11 +229,11 @@
 _on_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer *data)
 {
  /*printf("is awn applet dialog? %i\n", AWN_IS_APPLET_DIALOG(widget)); */
- if (event->keyval == 65307 && AWN_IS_APPLET_DIALOG(widget))
+ if (event->keyval == GDK_Escape && AWN_IS_APPLET_DIALOG(widget)) //65307
         {
   AWN_APPLET_DIALOG(widget)->applet = NULL;
   gtk_widget_destroy(widget);
  }
- return TRUE;
+ return FALSE;
 }

=== modified file 'libawn/awn-applet.c'
--- libawn/awn-applet.c 2007-07-30 23:21:37 +0000
+++ libawn/awn-applet.c 2007-08-06 09:07:06 +0000
@@ -264,7 +264,7 @@
 awn_applet_expose_event (GtkWidget *widget, GdkEventExpose *expose)
 {
  cairo_t *cr = NULL;
- GtkWidget *child = NULL;
+ GtkWidget *child = NULL;

  if (!GDK_IS_DRAWABLE (widget->window))
   return FALSE;
@@ -281,10 +281,10 @@
  /* Clean up */
  cairo_destroy (cr);

- /* Propagate the signal */
- child = gtk_bin_get_child (GTK_BIN (widget));
+ /* Propagate the signal */
+ child = gtk_bin_get_child (GTK_BIN (widget));
  if (child)
- gtk_container_propagate_expose (GTK_CONTAINER (widget), child, expose);
+ gtk_container_propagate_expose (GTK_CONTAINER (widget), child, expose);

  return FALSE;
 }

Garoth (garoth) wrote :

That seems to be patch to solve the issue, miika. Could you please commit it, so that he can keep working on the applet?

Changed in awn:
assignee: nobody → mpmatikainen

Thanks for the patch. Merged to trunk.

Changed in awn:
importance: Undecided → Medium
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers