4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU Library General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
* Jochen Baier, 2004, 2005, 2006 (email@Jochen-Baier.de)
31
* steal-xwin.c (acano@systec.com)
32
* xswallow (Caolan McNamara ?)
33
* kdocker (Girish Ramakrishnan)
34
* libwnck (Havoc Pennington <hp@redhat.com>)
35
* eggtrayicon (Anders Carlsson <andersca@gnu.org>)
36
* dsimple.c ("The Open Group")
37
* xfwm4 (Olivier Fourdan <fourdan@xfce.org>)
38
* .....lot more, THANX !!!
45
#include "clientwin.h"
52
expose_handler (GtkWidget *widget,
53
GdkEventExpose *event,
56
gtk_paint_flat_box (widget->style, widget->window,
57
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
58
NULL, widget, "tooltip",
61
gdk_draw_rectangle (widget->window, widget->style->black_gc,
62
0, label3->allocation.x+4, label3->allocation.y+2,
63
label3->allocation.width-8, label3->allocation.height-3);
74
GtkWidget *hseparator1;
78
window1 = gtk_window_new (GTK_WINDOW_POPUP);
79
gtk_container_set_border_width (GTK_CONTAINER (window1), 8);
80
gtk_window_set_title (GTK_WINDOW (window1), "alltray-clickmode");
81
gtk_window_set_position (GTK_WINDOW (window1), GTK_WIN_POS_CENTER);
82
gtk_window_set_resizable (GTK_WINDOW (window1), FALSE);
83
gtk_window_set_decorated (GTK_WINDOW (window1), FALSE);
84
gtk_widget_set_app_paintable (window1, TRUE);
85
gtk_window_set_policy (GTK_WINDOW (window1), FALSE, FALSE, TRUE);
87
vbox1 = gtk_vbox_new (FALSE, 0);
88
gtk_widget_show (vbox1);
89
gtk_container_add (GTK_CONTAINER (window1), vbox1);
91
label1 = gtk_label_new ("AllTray");
92
gtk_widget_show (label1);
93
gtk_box_pack_start (GTK_BOX (vbox1), label1, FALSE, FALSE, 0);
94
gtk_misc_set_padding (GTK_MISC (label1), 0, 1);
96
hseparator1 = gtk_hseparator_new ();
97
gtk_widget_show (hseparator1);
98
gtk_box_pack_start (GTK_BOX (vbox1), hseparator1, TRUE, TRUE, 0);
100
label2 = gtk_label_new ("Please click on the window\nyou would like to dock.");
101
gtk_widget_show (label2);
102
gtk_box_pack_start (GTK_BOX (vbox1), label2, FALSE, FALSE, 0);
103
gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_CENTER);
104
gtk_misc_set_padding (GTK_MISC (label2), 0, 2);
106
label3 = gtk_label_new ("Cancel");
107
gtk_widget_show (label3);
108
gtk_box_pack_start (GTK_BOX (vbox1), label3, FALSE, FALSE, 0);
109
gtk_misc_set_padding (GTK_MISC (label3), 0, 6);
112
g_signal_connect ((gpointer) window1, "expose_event",
113
G_CALLBACK (expose_handler),
121
static GdkFilterReturn root_filter (GdkXEvent *xevent,
122
GdkEvent *event2, gpointer user_data)
124
XEvent *event = (XEvent *)xevent;
125
Window target_win = None;
126
Window target_win_xmu = None;
128
win_struct *win= (win_struct*) user_data;
130
switch (event->type) {
134
target_win= event->xbutton.subwindow;
135
target_win_xmu=ClientWindow (target_win);
137
//if (debug) printf ("target win: %d\n", target_win);
138
//if (debug) printf ("target win xmu : %d\n", target_win_xmu);
140
if (target_win == dialog_xlib || (
142
target_win != None &&
143
target_win != GDK_ROOT_WINDOW() &&
144
target_win != target_win_xmu &&
145
window_type_is_normal (target_win_xmu))) {
147
gdk_pointer_ungrab (GDK_CURRENT_TIME);
148
gdk_window_remove_filter (gdk_get_default_root_window (), root_filter, NULL);
149
gtk_widget_destroy(dialog);
151
if (target_win == dialog_xlib) {
152
if (debug) printf ("cancle");
156
if (debug) printf ("found alltrayable window");
157
win->child_xlib=target_win_xmu;
167
return GDK_FILTER_CONTINUE;
171
void new_grab (win_struct *win)
174
GdkCursor *cursor = gdk_cursor_new (GDK_CROSSHAIR);
175
gdk_pointer_grab (gdk_get_default_root_window() , FALSE, GDK_BUTTON_PRESS_MASK,
176
gdk_get_default_root_window(), cursor, GDK_CURRENT_TIME);
178
gdk_cursor_unref (cursor);
179
gdk_window_add_filter (gdk_get_default_root_window(), root_filter, win);
183
void click_mode(win_struct *win)
186
dialog=create_dialog();
187
gtk_widget_show (dialog);
189
dialog_xlib=GDK_WINDOW_XID(dialog->window);