summaryrefslogtreecommitdiff
blob: 3e50600f51d895fa4e55e108ed102b1c2b9c0fb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
diff -ru orig/wmcliphist-0.6/foodock/foodock.c wmcliphist-0.6/foodock/foodock.c
--- orig/wmcliphist-0.6/foodock/foodock.c	2001-03-16 01:59:46.000000000 +0100
+++ wmcliphist-0.6/foodock/foodock.c	2007-08-12 16:34:44.818138390 +0200
@@ -21,6 +21,8 @@
  * before calling foo_create_main_icon_window. Returned event box
  * will be realized by foo_create_main_icon_window. You should to show
  * icon window as well as main window before gtk_main().
+ *
+ * Call foo_set_wmhints() after both windows are shown (gtk_widget_show()).
  * 
  * Input:
  *	mw		Pointer to main window
@@ -34,20 +36,37 @@
 				       char *margv[]) {
 
     GtkWidget *foobox; /* This will become icon box */
-    Window xmw;
-    XWMHints *wm_hints;
-
-    xmw = GDK_WINDOW_XWINDOW(mw->window);
     
     foobox = gtk_event_box_new();
     gtk_widget_set_usize(foobox, s, s);
     gtk_container_add (GTK_CONTAINER (mw), foobox);
     gtk_widget_realize(foobox);
-    
+
+    return foobox;
+}
+
+/*
+ * Set WMHints on the dockapp (icon) window. Needs to be called after
+ * the main window is shown, due to changes in GTK+ 2.4.
+ * 
+ * Input:
+ *	mw		Pointer to main window
+ *	dw		Pointer to icon (dockapp) window
+ *	margc, margv	argc and argv of main program for XSetCommand
+ */
+void foo_set_wmhints(GtkWidget *mw,
+		     GtkWidget *dw,
+		     int margc,
+		     char *margv[]) {
+    Window xmw;
+    XWMHints *wm_hints;
+
+    xmw = GDK_WINDOW_XWINDOW(mw->window);
+
 /* Time for game with Xlib */
     wm_hints = XAllocWMHints();
     wm_hints->window_group = xmw;
-    wm_hints->icon_window = GDK_WINDOW_XWINDOW(foobox->window);
+    wm_hints->icon_window = GDK_WINDOW_XWINDOW(dw->window);
     wm_hints->icon_x = 0;
     wm_hints->icon_y = 0; 
     wm_hints->initial_state = WithdrawnState;
@@ -60,6 +79,4 @@
     XSetCommand(GDK_DISPLAY(), xmw, margv, margc);
     
     XFree(wm_hints);
-    
-    return foobox;
 }
diff -ru orig/wmcliphist-0.6/foodock/foodock.h wmcliphist-0.6/foodock/foodock.h
--- orig/wmcliphist-0.6/foodock/foodock.h	2001-03-16 01:59:52.000000000 +0100
+++ wmcliphist-0.6/foodock/foodock.h	2007-08-12 16:34:40.317881934 +0200
@@ -15,6 +15,8 @@
  * before calling foo_create_main_icon_window. Returned event box
  * will be realized by foo_create_main_icon_window. You should to show
  * icon window as well as main window before gtk_main().
+ *
+ * Call foo_set_wmhints() after both windows are shown (gtk_widget_show()).
  * 
  * Input:
  *	mw		Pointer to main window
@@ -25,3 +27,17 @@
 				       unsigned int size,
 				       int main_argc,
 				       char *main_argv[]);
+
+/*
+ * Set WMHints on the dockapp (icon) window. Needs to be called after
+ * the main window is shown, due to changes in GTK+ 2.4.
+ * 
+ * Input:
+ *	mw		Pointer to main window
+ *	dw		Pointer to icon (dockapp) window
+ *	margc, margv	argc and argv of main program for XSetCommand
+ */
+void foo_set_wmhints(GtkWidget *mw,
+		     GtkWidget *dw,
+		     int margc,
+		     char *margv[]);
diff -ru orig/wmcliphist-0.6/wmcliphist.c wmcliphist-0.6/wmcliphist.c
--- orig/wmcliphist-0.6/wmcliphist.c	2003-06-23 23:24:24.000000000 +0200
+++ wmcliphist-0.6/wmcliphist.c	2007-08-12 16:31:20.806512430 +0200
@@ -333,6 +333,10 @@
 	/* show icon */
 	gtk_widget_show(dock_app);
 	gtk_widget_show(main_window);
+
+	/* Set WMHints - after gtk_widget_show() due to changes in GTK+ 2.4 */
+	foo_set_wmhints(main_window, dock_app, argc, argv);
+
 	gdk_window_shape_combine_mask(main_window->window, icon_mask, 0, 0);
 	gdk_window_shape_combine_mask(dock_app->window, icon_mask, 0, 0);