On Win32 call gtk_status_icon_button_press() in an idle callback and not
2007-07-04 Tor Lillqvist <tml@novell.com> * gtk/gtkstatusicon.c: On Win32 call gtk_status_icon_button_press() in an idle callback and not directly from the window procedure to avoid "g_main_loop_run(): called recursively from within a source's check() or prepare() member, iteration not possible" warnings. svn path=/branches/gtk-2-10/; revision=18376
This commit is contained in:
committed by
Tor Lillqvist
parent
25b8260a1b
commit
bbebdab86e
@@ -1,3 +1,11 @@
|
||||
2007-07-04 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* gtk/gtkstatusicon.c: On Win32 call
|
||||
gtk_status_icon_button_press() in an idle callback and not
|
||||
directly from the window procedure to avoid "g_main_loop_run():
|
||||
called recursively from within a source's check() or prepare()
|
||||
member, iteration not possible" warnings.
|
||||
|
||||
2007-07-03 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtkbutton.c (gtk_button_construct_child): Don't leave
|
||||
|
||||
@@ -292,7 +292,6 @@ gtk_status_icon_class_init (GtkStatusIconClass *class)
|
||||
static void
|
||||
build_button_event (GtkStatusIconPrivate *priv,
|
||||
GdkEventButton *e,
|
||||
GdkEventType type,
|
||||
guint button)
|
||||
{
|
||||
POINT pos;
|
||||
@@ -300,8 +299,7 @@ build_button_event (GtkStatusIconPrivate *priv,
|
||||
|
||||
/* We know that gdk/win32 puts the primary monitor at index 0 */
|
||||
gdk_screen_get_monitor_geometry (gdk_screen_get_default (), 0, &monitor0);
|
||||
e->type = type;
|
||||
e->window = gdk_get_default_root_window ();
|
||||
e->window = g_object_ref (gdk_get_default_root_window ());
|
||||
e->send_event = TRUE;
|
||||
e->time = GetTickCount ();
|
||||
GetCursorPos (&pos);
|
||||
@@ -315,6 +313,25 @@ build_button_event (GtkStatusIconPrivate *priv,
|
||||
e->y_root = e->y;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkStatusIcon *status_icon;
|
||||
GdkEventButton *event;
|
||||
} ButtonCallbackData;
|
||||
|
||||
static gboolean
|
||||
button_callback (gpointer data)
|
||||
{
|
||||
ButtonCallbackData *bc = (ButtonCallbackData *) data;
|
||||
|
||||
gtk_status_icon_button_press (bc->status_icon, bc->event);
|
||||
|
||||
gdk_event_free ((GdkEvent *) bc->event);
|
||||
g_free (data);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK
|
||||
wndproc (HWND hwnd,
|
||||
UINT message,
|
||||
@@ -323,16 +340,17 @@ wndproc (HWND hwnd,
|
||||
{
|
||||
if (message == WM_GTK_TRAY_NOTIFICATION)
|
||||
{
|
||||
GdkEventButton e;
|
||||
GtkStatusIcon *status_icon = GTK_STATUS_ICON (wparam);
|
||||
ButtonCallbackData *bc;
|
||||
|
||||
switch (lparam)
|
||||
{
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_RBUTTONDOWN:
|
||||
build_button_event (status_icon->priv, &e, GDK_BUTTON_PRESS,
|
||||
(lparam == WM_LBUTTONDOWN) ? 1 : 3);
|
||||
gtk_status_icon_button_press (status_icon, &e);
|
||||
bc = g_new (ButtonCallbackData, 1);
|
||||
bc->event = (GdkEventButton *) gdk_event_new (GDK_BUTTON_PRESS);
|
||||
bc->status_icon = GTK_STATUS_ICON (wparam);
|
||||
build_button_event (bc->status_icon->priv, bc->event, (lparam == WM_LBUTTONDOWN) ? 1 : 3);
|
||||
g_idle_add (button_callback, bc);
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user