aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-09-16 13:24:49 -0500
committerTed Gould <ted@gould.cx>2011-09-16 13:24:49 -0500
commit08a590ace9373af704afc48811d65f44cc606c28 (patch)
tree8c67675cb293f4436a010ab68fd4eb9bbba6f212 /src
parent1415b10dfec89dd58e5f1ed6389e3fff85c2932a (diff)
parent3abfadde5be590360900ce3ca92195fab7496ec5 (diff)
downloadayatana-ido-08a590ace9373af704afc48811d65f44cc606c28.tar.gz
ayatana-ido-08a590ace9373af704afc48811d65f44cc606c28.tar.bz2
ayatana-ido-08a590ace9373af704afc48811d65f44cc606c28.zip
Fix the calendar item
Diffstat (limited to 'src')
-rw-r--r--src/idocalendarmenuitem.c61
1 files changed, 46 insertions, 15 deletions
diff --git a/src/idocalendarmenuitem.c b/src/idocalendarmenuitem.c
index 6d5c077..40d96a1 100644
--- a/src/idocalendarmenuitem.c
+++ b/src/idocalendarmenuitem.c
@@ -196,31 +196,62 @@ static gboolean
ido_calendar_menu_item_button_press (GtkWidget *widget,
GdkEventButton *event)
{
- GtkWidget *calendar = IDO_CALENDAR_MENU_ITEM (widget)->priv->calendar;
+ GtkWidget *calendar = IDO_CALENDAR_MENU_ITEM (widget)->priv->calendar;
- if (event->button == 1)
- {
- if (gtk_widget_get_window (calendar) != NULL)
- {
- gdk_window_raise (gtk_widget_get_window (calendar));
- }
+ if (event->button == 1) {
+ if (gtk_widget_get_window (calendar) != NULL) {
+ gdk_window_raise (gtk_widget_get_window (calendar));
+ }
- if (!gtk_widget_has_focus (calendar))
- {
- gtk_widget_grab_focus (calendar);
- }
+ if (!gtk_widget_has_focus (calendar)) {
+ gtk_widget_grab_focus (calendar);
+ }
- return TRUE;
- }
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkEvent * newevent = gdk_event_copy((GdkEvent *)(event));
+ GList * children = gdk_window_get_children(gtk_widget_get_window(calendar));
+ GList * child;
- return FALSE;
+ gint root_x = event->x_root;
+ gint root_y = event->y_root;
+
+ 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_origin(newwindow, &winx, &winy);
+ newx = root_x - winx;
+ newy = root_y - winy;
+
+ if (newx >= 0 && newy >= 0 && newx < gdk_window_get_width(newwindow) && newy < gdk_window_get_height(newwindow)) {
+ ((GdkEventButton *)newevent)->x = newx;
+ ((GdkEventButton *)newevent)->y = newy;
+
+ GTK_WIDGET_GET_CLASS(calendar)->button_press_event(GTK_WIDGET(calendar), (GdkEventButton*)newevent);
+ }
+ }
+
+ ((GdkEventButton *)newevent)->window = event->window;
+ gdk_event_free(newevent);
+#endif
+
+ return TRUE;
+ }
+
+ return FALSE;
}
static gboolean
ido_calendar_menu_item_button_release (GtkWidget *widget,
GdkEventButton *event)
{
- // GtkWidget *calendar = IDO_CALENDAR_MENU_ITEM (widget)->priv->calendar;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkWidget *calendar = IDO_CALENDAR_MENU_ITEM (widget)->priv->calendar;
+ GTK_WIDGET_GET_CLASS(calendar)->button_release_event(GTK_WIDGET(calendar), event);
+#endif
return TRUE;
}