diff options
author | Ted Gould <ted@gould.cx> | 2011-09-15 16:04:16 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-09-15 16:04:16 -0500 |
commit | f4c7db4eb405883a596ad00391fa9d35334640f0 (patch) | |
tree | c3bcf162989a05d0b09f04c90c3474f2e82d528c | |
parent | 0b3ce25c4bebb38f0845c0a0e983b3cc91ff13ce (diff) | |
download | ayatana-ido-f4c7db4eb405883a596ad00391fa9d35334640f0.tar.gz ayatana-ido-f4c7db4eb405883a596ad00391fa9d35334640f0.tar.bz2 ayatana-ido-f4c7db4eb405883a596ad00391fa9d35334640f0.zip |
A check point
-rw-r--r-- | src/idocalendarmenuitem.c | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/src/idocalendarmenuitem.c b/src/idocalendarmenuitem.c index 6d5c077..ec2e2b4 100644 --- a/src/idocalendarmenuitem.c +++ b/src/idocalendarmenuitem.c @@ -197,19 +197,57 @@ ido_calendar_menu_item_button_press (GtkWidget *widget, GdkEventButton *event) { GtkWidget *calendar = IDO_CALENDAR_MENU_ITEM (widget)->priv->calendar; + g_debug("Button Press"); if (event->button == 1) { if (gtk_widget_get_window (calendar) != NULL) { gdk_window_raise (gtk_widget_get_window (calendar)); + g_debug("Raise window"); } if (!gtk_widget_has_focus (calendar)) { gtk_widget_grab_focus (calendar); + g_debug("Grab focus: %d", gtk_widget_has_focus(calendar)); } - +GdkEvent * newevent = gdk_event_copy((GdkEvent *)(event)); +GList * children = gdk_window_get_children(gtk_widget_get_window(calendar)); +GList * child; +gint root_x, root_y; + +gdk_window_get_position(gtk_widget_get_window(widget), &root_x, &root_y); +root_x += event->x; +root_y += event->y; +g_debug("Root X: %d Y: %d", root_x, root_y); + +for (child = children; child != NULL; child = g_list_next(child)) { +gint newx, newy; +gint winx, winy; +GdkWindow * newwindow = (GdkWindow*)child->data; + +((GdkEventButton *)newevent)->window = newwindow; + +//gdk_window_get_position((GdkWindow*)child->data, &winx, &winy); +gdk_window_get_position(newwindow, &winx, &winy); +newx = root_x - winx; +newy = root_y - winy; + + +if (newx >= 0 && newy >= 0) { +//if (newx >= 0 && newy >= 0 && newx < gdk_window_get_width(newwindow) && newy < gdk_window_get_height(newwindow)) { +gboolean returned = FALSE; +g_debug("Simulating event at: %dx%d", newx, newy); +((GdkEventButton *)newevent)->x = newx; +((GdkEventButton *)newevent)->y = newy; + + returned = GTK_WIDGET_GET_CLASS(calendar)->button_press_event(GTK_WIDGET(calendar), (GdkEventButton*)newevent); + if (returned) { + g_debug("\tHandled"); + } + } + } return TRUE; } @@ -220,7 +258,18 @@ static gboolean ido_calendar_menu_item_button_release (GtkWidget *widget, GdkEventButton *event) { + g_debug("Button Release"); // GtkWidget *calendar = IDO_CALENDAR_MENU_ITEM (widget)->priv->calendar; + GtkWidget *calendar = IDO_CALENDAR_MENU_ITEM (widget)->priv->calendar; + +GdkEvent * newevent = gdk_event_copy((GdkEvent *)(event)); +GList * children = gdk_window_get_children(gtk_widget_get_window(calendar)); +GList * child; +for (child = children; child != NULL; child = g_list_next(child)) { +((GdkEventButton *)newevent)->window = (GdkWindow*)child->data; + + GTK_WIDGET_GET_CLASS(calendar)->button_release_event(GTK_WIDGET(calendar), (GdkEventButton*)newevent); + } return TRUE; } |