Why is minimizing an app and switching the desktop resulting in the same window-event: ICONIFIED ?
- From: Rorschach <r0rschach lavabit com>
- To: gtk-app-devel-list gnome org
- Subject: Why is minimizing an app and switching the desktop resulting in the same window-event: ICONIFIED ?
- Date: Wed, 17 Sep 2008 19:57:05 +0200
Hi,
I'm writing a trayicon (gtk-status-icon) in C for a linux-application. I created an event-handler for
window-state-events. When the window gets minimized I wanna hide it to the tray. That means if the
changed_mask and new_window_state become GDK_WINDOW_STATE_ICONIFIED.
But my problem is that also just switching to another desktop under X results in the state-handler to get
executed and the window gets the ICONIFIED-state. Why is minimizing a window and switching the desktop are
having the same state in GDK?
Here a little proof:
#include <gtk/gtk.h>
#include <stdio.h>
gboolean window_state_event (GtkWidget *widget, GdkEventWindowState *event)
{
printf("%d\n",event->changed_mask);
printf("%d\n\n",event->new_window_state);
return TRUE;
}
int main( int argc,char *argv[] )
{
GtkWidget *window;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_show (window);
g_signal_connect (G_OBJECT (window), "window-state-event", G_CALLBACK (window_state_event),NULL);
gtk_main();
return 0;
}
Just compile with:
gcc test.c -o test -Wall -Werror -pedantic `pkg-config --cflags --libs gtk+-2.0`
And now you can test it. Minimize the window, which results in:
2
2
or switch the desktop while the window is visible, again:
2
2
So now for my problem: when I code a trayicon I wanna hide it when it gets minimized but not! when a user
switched the desktop. This seems impossible because the event is the same. Do you have any idea, any thoughts
with this? Any help or hint is really appreatiated!
cu
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]