aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-09-15 16:04:16 -0500
committerTed Gould <ted@gould.cx>2011-09-15 16:04:16 -0500
commitf4c7db4eb405883a596ad00391fa9d35334640f0 (patch)
treec3bcf162989a05d0b09f04c90c3474f2e82d528c /src
parent0b3ce25c4bebb38f0845c0a0e983b3cc91ff13ce (diff)
downloadayatana-ido-f4c7db4eb405883a596ad00391fa9d35334640f0.tar.gz
ayatana-ido-f4c7db4eb405883a596ad00391fa9d35334640f0.tar.bz2
ayatana-ido-f4c7db4eb405883a596ad00391fa9d35334640f0.zip
A check point
Diffstat (limited to 'src')
-rw-r--r--src/idocalendarmenuitem.c51
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;
}