From: Hugo Villeneuve Date: Fri, 31 May 2013 23:58:33 +0000 (-0400) Subject: Refactor window initial state setting in separate function X-Git-Tag: v1.1.0~25 X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=74c591c0221c75685340170aefb92bdac9f29008;p=dockapps%2Fhvclock.git Refactor window initial state setting in separate function --- diff --git a/src/dockapp.c b/src/dockapp.c index 59984c3..6558ab6 100644 --- a/src/dockapp.c +++ b/src/dockapp.c @@ -45,6 +45,18 @@ /* Specifies the border width */ #define BWIDTH 2 +static void +dockapp_set_withdrawn_state(Display *d, Window w) +{ + XWMHints *hints; + + hints = XGetWMHints(d, w); + hints->flags |= StateHint; + hints->initial_state = WithdrawnState; + XSetWMHints(d, w, hints); + XFree(hints); +} + /******************************************************************************* * New window creation and initialization for a Dockable Application ******************************************************************************/ @@ -53,7 +65,6 @@ dockapp_init(int argc, char *argv[], char *display_arg, char *geometry_arg) { GtkWidget *dockwin; GtkWidget *iconwin; - XWMHints wm_hints; gtk_init(&argc, &argv); @@ -75,13 +86,8 @@ dockapp_init(int argc, char *argv[], char *display_arg, char *geometry_arg) gtk_widget_show_all(dockwin); if (hvclock_infos.dockapp_mode == true) { - /* Dockapp specific initialization */ - wm_hints.flags = StateHint | IconWindowHint | WindowGroupHint; - wm_hints.initial_state = WithdrawnState; - wm_hints.icon_window = GDK_WINDOW_XWINDOW(iconwin->window); - wm_hints.window_group = GDK_WINDOW_XWINDOW(dockwin->window); - - XSetWMHints(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), - GDK_WINDOW_XWINDOW(dockwin->window), &wm_hints); + dockapp_set_withdrawn_state( + GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), + GDK_WINDOW_XWINDOW(dockwin->window)); } }