53
53
win->parent_is_visible=new_state;
57
57
static GdkFilterReturn
58
root_filter_manager_window (GdkXEvent *xevent,
58
root_filter_manager_window (GdkXEvent *xevent,
59
59
GdkEvent *event, gpointer user_data)
62
62
XEvent *xev = (XEvent *)xevent;
64
64
//win_struct *win= (win_struct *) user_data;
66
66
if (debug) printf ("root_filter_manager_window event\n");
68
68
if (xev->xany.type == ClientMessage &&
69
69
xev->xclient.message_type == manager_atom &&
70
70
xev->xclient.data.l[1] == selection_atom) {
72
72
display_window_id (GDK_DISPLAY(), xev->xclient.window);
74
74
if (debug) printf ("manager: here i am\n");
80
80
return GDK_FILTER_CONTINUE;
86
86
win->manager_window=get_manager_window();
88
88
if (win->manager_window == None) {
90
90
printf ("\nAlltray: no system tray/notification area found.\n"\
91
91
"I will wait..... I have time....\n\n"\
92
92
"In the meantime you may add a system tray applet\n"\
93
93
"to the panel.\n");
95
95
gdk_window_add_filter(win->root_gdk, root_filter_manager_window, (gpointer) win);
97
97
gdk_window_remove_filter(win->root_gdk, root_filter_manager_window, (gpointer) win);
100
100
else { if (debug) printf ("HAVE MANAGER WINDOW\n");};
103
GdkFilterReturn parent_window_filter (GdkXEvent *xevent,
103
GdkFilterReturn parent_window_filter (GdkXEvent *xevent,
104
104
GdkEvent *event, gpointer user_data)
106
106
XEvent *xev = (XEvent *)xevent;
107
107
XConfigureEvent *xconfigure;
108
108
XVisibilityEvent *xvisibilty;
109
109
XConfigureRequestEvent *xconfigurerequest;
111
111
gint return_type=GDK_FILTER_CONTINUE;
113
113
win_struct *win= (win_struct*) user_data;
115
115
switch (xev->xany.type) {
120
120
if (debug) printf ("map notify\n");
122
122
update_visibility_state (win, window_is_visible);
126
126
case UnmapNotify:
128
128
if (debug) printf ("unmap notify\n");
130
130
update_visibility_state (win, window_is_hidden);
135
135
case ConfigureNotify:
137
//if (debug) printf ("configure notify\n");
137
//if (debug) printf ("configure notify\n");
139
139
xconfigure = (XConfigureEvent*) xev;
141
141
static gint old_width=0;
142
142
static gint old_height=0;
144
144
if (old_width == xconfigure->width && old_height == xconfigure->height)
147
147
old_width=xconfigure->width;
148
148
old_height=xconfigure->height;
150
150
gdk_window_resize (win->child_gdk, old_width, old_height);
154
154
case ClientMessage:
156
156
if (xev->xclient.data.l[0] == wm_delete_window) {
157
157
if (debug) printf ("delete event!\n");
159
159
show_hide_window (win, force_hide, FALSE);
163
163
if (xev->xclient.data.l[0] == wm_take_focus) {
164
164
if (debug) printf ("wm take focus !!!\n");
166
166
if (!assert_window(win->child_xlib)) {
167
167
if (debug) printf ("can not set focus to child ! assert(window) failed\n");
171
171
while (!xlib_window_is_viewable (win->child_xlib))
174
XSetInputFocus (win->display, win->child_xlib,
174
XSetInputFocus (win->display, win->child_xlib,
175
175
RevertToParent, xev->xclient.data.l[1]);
180
180
if (xev->xclient.data.l[0] == net_wm_ping) {
181
181
if (debug) printf ("net wm ping!\n");
183
183
XEvent xe = *xev;
185
185
xe.xclient.window = win->root_xlib;
186
XSendEvent (win->display, win->root_xlib, False,
186
XSendEvent (win->display, win->root_xlib, False,
187
187
SubstructureRedirectMask | SubstructureNotifyMask, &xe);
194
194
case VisibilityNotify:
196
196
xvisibilty = (XVisibilityEvent*) xev;
198
198
win->visibility=xvisibilty->state;
200
200
if (debug) printf ("visibility notify state: %d\n", win->visibility);
204
204
/*bad child wanted to move inside parent -> deny*/
205
205
case ConfigureRequest:
207
207
xconfigurerequest = (XConfigureRequestEvent*) xev;
209
209
if (debug) printf ("child configure request\n");
211
211
if (xconfigurerequest->x !=0 || xconfigurerequest->y != 0) {
213
213
if (debug) printf ("deny configure request\n");
214
214
return_type=GDK_FILTER_REMOVE;
222
222
return return_type;
225
225
gboolean parse_arguments(int argc, char **argv, gchar **icon,
226
226
gchar **rest, gboolean *show, gboolean *debug, gboolean *borderless, gboolean *sticky,
227
gboolean *skip_tasklist, gboolean *no_title, gboolean *configure, gboolean *large_icons,
227
gboolean *skip_tasklist, gboolean *configure, gboolean *large_icons,
228
228
GArray *command_menu, gint *title_time, gchar **geometry,
229
229
unsigned int *shortcut_key, unsigned int *shortcut_modifier, gboolean *notray, gboolean *nomini)
268
268
if (!strcmp(argv[i], "--notray") || !strcmp(argv[i], "-nt")) {
273
273
if (!strcmp(argv[i], "--nominimize") || !strcmp(argv[i], "-nm")) {
278
278
if (!strcmp(argv[i], "--sticky") || !strcmp(argv[i], "-st")) {
283
283
if (!strcmp(argv[i], "--skip-taskbar") || !strcmp(argv[i], "-stask")) {
284
284
*skip_tasklist=TRUE;
288
if (!strcmp(argv[i], "--no-alltray") || !strcmp(argv[i], "-na")) {
293
288
if (!strcmp(argv[i], "--configure") || !strcmp(argv[i], "-conf")) {
298
293
if (!strcmp(argv[i], "--large_icons") || !strcmp(argv[i], "-l")) {
299
294
*large_icons=TRUE;
304
298
if (!strcmp(argv[i], "--icon") || !strcmp(argv[i], "-i")) {
305
299
if ((i+1) == argc) {
310
304
*icon=g_strdup (argv[i+1]);
321
315
shortcut=g_strdup (argv[i+1]);
323
317
if (!parse_shortcut (shortcut, shortcut_key, shortcut_modifier))
326
320
g_free (shortcut);
332
326
if (!strcmp(argv[i], "--geometry") || !strcmp(argv[i], "-g")) {
333
327
if ((i+1) == argc) {
338
332
*geometry=g_strdup (argv[i+1]);
340
334
if (XParseGeometry(*geometry, &x, &y, (unsigned int *) &w, (unsigned int *) &h) == 0) {
349
343
if (!strcmp(argv[i], "--title") || !strcmp(argv[i], "-t")) {
350
344
if ((i+1) == argc) {
355
349
*title_time=atoi (argv[i+1]);
357
351
if (*title_time == 0) {
366
360
if (!strcmp(argv[i], "--menu") || !strcmp(argv[i], "-m")) {
367
361
if ((i+1) == argc) {
372
366
if (!append_command_to_menu(command_menu, argv[i+1])) {
373
367
printf ("\nAllTray: \"%s\" is not a valid menu entry !\n"\
374
368
" Syntax: -m \"menu text:command\"\n", argv[i+1]);