wmcliphist: Add version 2.0 to repository.
[dockapps.git] / wmcliphist / foodock / foodock.c
blob9c712755ec1400ca320821e724147e4fbb7c7b3a
1 /*
2 * File: foodock.c
4 * Created: Fri Jan 14 01:15:24 2000
5 *
6 * (c) 2000, Alexey Vyskubov <alexey@pepper.spb.ru>
8 * LGPL, see file LICENSE
9 */
11 #include <gtk/gtk.h>
12 #include <gdk/gdk.h>
13 #include <gdk/gdkx.h>
15 #include "foodock.h"
18 * Function foo_create_main_icon_window returns pointer to gtk event
19 * box. This event box is created into main window and can be used as
20 * a dockable Windowmaker applet. Main window should be realized
21 * before calling foo_create_main_icon_window. Returned event box
22 * will be realized by foo_create_main_icon_window. You should to show
23 * icon window as well as main window before gtk_main().
25 * Call foo_set_wmhints() after both windows are shown (gtk_widget_show()).
27 * Input:
28 * mw Pointer to main window
29 * s icon window size (56 is recommended)
30 * margc, margv argc and argv of main program for XSetCommand
33 GtkWidget *foo_create_main_icon_window(GtkWidget *mw,
34 unsigned int s,
35 int margc,
36 char *margv[]) {
38 GtkWidget *foobox; /* This will become icon box */
40 foobox = gtk_event_box_new();
41 gtk_widget_set_usize(foobox, s, s);
42 gtk_container_add (GTK_CONTAINER (mw), foobox);
43 gtk_widget_realize(foobox);
45 return foobox;
49 * Set WMHints on the dockapp (icon) window. Needs to be called after
50 * the main window is shown, due to changes in GTK+ 2.4.
52 * Input:
53 * mw Pointer to main window
54 * dw Pointer to icon (dockapp) window
55 * margc, margv argc and argv of main program for XSetCommand
57 void foo_set_wmhints(GtkWidget *mw,
58 GtkWidget *dw,
59 int margc,
60 char *margv[]) {
61 Window xmw;
62 XWMHints *wm_hints;
64 xmw = GDK_WINDOW_XWINDOW(mw->window);
67 /* Time for game with Xlib */
68 wm_hints = XAllocWMHints();
69 wm_hints->window_group = xmw;
70 wm_hints->icon_window = GDK_WINDOW_XWINDOW(dw->window);
71 wm_hints->icon_x = 0;
72 wm_hints->icon_y = 0;
73 wm_hints->initial_state = WithdrawnState;
74 wm_hints->flags = StateHint |
75 IconPositionHint |
76 WindowGroupHint |
77 IconWindowHint |
78 InputHint;
80 XSetWMHints(GDK_DISPLAY(), xmw, wm_hints);
82 XSetCommand(GDK_DISPLAY(), xmw, margv, margc);
84 XFree(wm_hints);