]>
Dogcows Code - chaz/tint2/blob - src/tint.c
b0152c63434e7ea74d0ef2b9cb8eab924f059ffd
1 /**************************************************************************
5 * Copyright (C) 2007 Pål Staurland (staura@gmail.com)
6 * Modified (C) 2008 thierry lorthiois (lorthiois@bbsoft.fr)
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 **************************************************************************/
27 #include <X11/Xutil.h>
28 #include <X11/Xatom.h>
29 #include <X11/Xlocale.h>
30 #include <X11/extensions/Xdamage.h>
40 #include "systraybar.h"
45 void signal_handler(int sig
)
47 // signal handler is light as it should be
52 void init (int argc
, char *argv
[])
57 for (i
= 1; i
< argc
; ++i
) {
58 if (!strcmp(argv
[i
], "-h") || !strcmp(argv
[i
], "--help")) {
59 printf("Usage: tint2 [-c] <config_file>\n");
62 if (!strcmp(argv
[i
], "-v") || !strcmp(argv
[i
], "--version")) {
63 printf("tint2 version %s\n", VERSION_STRING
);
66 if (!strcmp(argv
[i
], "-c")) {
69 config_path
= strdup(argv
[i
]);
71 if (!strcmp(argv
[i
], "-s")) {
74 snapshot_path
= strdup(argv
[i
]);
78 struct sigaction sa
= { .sa_handler
= signal_handler
};
79 sigaction(SIGUSR1
, &sa
, 0);
80 sigaction(SIGINT
, &sa
, 0);
81 sigaction(SIGTERM
, &sa
, 0);
82 sigaction(SIGHUP
, &sa
, 0);
83 signal(SIGCHLD
, SIG_IGN
); // don't have to wait() after fork()
85 // BSD is too stupid to support pselect(), therefore we have to use select and hope that we do not
86 // end up in a race condition there
87 // block all signals, such that no race conditions occur before pselect in our main loop
88 // sigset_t block_mask;
89 // sigaddset(&block_mask, SIGINT);
90 // sigaddset(&block_mask, SIGTERM);
91 // sigaddset(&block_mask, SIGHUP);
92 // sigaddset(&block_mask, SIGUSR1);
93 // sigprocmask(SIG_BLOCK, &block_mask, 0);
96 memset(&server
, 0, sizeof(Server_global
));
97 memset(&systray
, 0, sizeof(Systraybar
));
102 server
.dsp
= XOpenDisplay (NULL
);
104 fprintf(stderr
, "tint2 exit : could not open display.\n");
107 server_init_atoms ();
108 server
.screen
= DefaultScreen (server
.dsp
);
109 server
.root_win
= RootWindow(server
.dsp
, server
.screen
);
110 server
.desktop
= server_get_current_desktop ();
111 server_init_visual();
112 XSetErrorHandler ((XErrorHandler
) server_catch_error
);
114 imlib_context_set_display (server
.dsp
);
115 imlib_context_set_visual (server
.visual
);
116 imlib_context_set_colormap (server
.colormap
);
119 XSelectInput (server
.dsp
, server
.root_win
, PropertyChangeMask
|StructureNotifyMask
);
121 setlocale (LC_ALL
, "");
125 const gchar
* const *data_dirs
;
126 data_dirs
= g_get_system_data_dirs ();
128 for (i
= 0; data_dirs
[i
] != NULL
; i
++) {
129 path
= g_build_filename(data_dirs
[i
], "tint2", "default_icon.png", NULL
);
130 if (g_file_test (path
, G_FILE_TEST_EXISTS
))
131 default_icon
= imlib_load_image(path
);
135 // get monitor and desktop config
149 #ifdef ENABLE_BATTERY
154 imlib_context_set_image(default_icon
);
157 if (config_path
) g_free(config_path
);
158 if (snapshot_path
) g_free(snapshot_path
);
161 if (server
.dsp
) XCloseDisplay(server
.dsp
);
165 void get_snapshot(const char *path
)
167 Panel
*panel
= &panel1
[0];
169 if (panel
->area
.width
> server
.monitor
[0].width
)
170 panel
->area
.width
= server
.monitor
[0].width
;
172 panel
->temp_pmap
= XCreatePixmap(server
.dsp
, server
.root_win
, panel
->area
.width
, panel
->area
.height
, server
.depth
);
173 refresh(&panel
->area
);
175 Imlib_Image img
= NULL
;
176 imlib_context_set_drawable(panel
->temp_pmap
);
177 img
= imlib_create_image_from_drawable(0, 0, 0, panel
->area
.width
, panel
->area
.height
, 0);
179 imlib_context_set_image(img
);
180 if (!panel_horizontal
) {
181 // rotate 90° vertical panel
182 imlib_image_flip_horizontal();
183 imlib_image_flip_diagonal();
185 imlib_save_image(path
);
187 XFreePixmap(server
.dsp
, panel
->temp_pmap
);
191 void window_action (Task
*tsk
, int action
)
197 set_close (tsk
->win
);
200 set_active(tsk
->win
);
203 XIconifyWindow (server
.dsp
, tsk
->win
, server
.screen
);
206 if (task_active
&& tsk
->win
== task_active
->win
)
207 XIconifyWindow (server
.dsp
, tsk
->win
, server
.screen
);
209 set_active (tsk
->win
);
212 window_toggle_shade (tsk
->win
);
214 case MAXIMIZE_RESTORE
:
215 window_maximize_restore (tsk
->win
);
218 window_maximize_restore (tsk
->win
);
221 window_maximize_restore (tsk
->win
);
224 if ( tsk
->desktop
== 0 ) break;
225 desk
= tsk
->desktop
- 1;
226 windows_set_desktop(tsk
->win
, desk
);
227 if (desk
== server
.desktop
)
228 set_active(tsk
->win
);
231 if (tsk
->desktop
== server
.nb_desktop
) break;
232 desk
= tsk
->desktop
+ 1;
233 windows_set_desktop(tsk
->win
, desk
);
234 if (desk
== server
.desktop
)
235 set_active(tsk
->win
);
240 tsk1
= next_task(task_active
);
241 set_active(tsk1
->win
);
247 tsk1
= prev_task(task_active
);
248 set_active(tsk1
->win
);
254 int tint2_handles_click(Panel
* panel
, XButtonEvent
* e
)
256 Task
* task
= click_task(panel
, e
->x
, e
->y
);
259 || (e
->button
== 2 && mouse_middle
!= 0)
260 || (e
->button
== 3 && mouse_right
!= 0)
261 || (e
->button
== 4 && mouse_scroll_up
!= 0)
262 || (e
->button
== 5 && mouse_scroll_down
!=0) )
269 // no task clicked --> check if taskbar clicked
270 Taskbar
*tskbar
= click_taskbar(panel
, e
->x
, e
->y
);
271 if (tskbar
&& e
->button
== 1 && panel_mode
== MULTI_DESKTOP
)
273 if (click_clock(panel
, e
->x
, e
->y
)) {
274 if ( (e
->button
== 1 && clock_lclick_command
) || (e
->button
== 3 && clock_rclick_command
) )
283 void forward_click(XEvent
* e
)
285 // forward the click to the desktop window (thanks conky)
286 XUngrabPointer(server
.dsp
, e
->xbutton
.time
);
287 e
->xbutton
.window
= server
.root_win
;
288 // icewm doesn't open under the mouse.
289 // and xfce doesn't open at all.
290 e
->xbutton
.x
= e
->xbutton
.x_root
;
291 e
->xbutton
.y
= e
->xbutton
.y_root
;
292 //printf("**** %d, %d\n", e->xbutton.x, e->xbutton.y);
293 //XSetInputFocus(server.dsp, e->xbutton.window, RevertToParent, e->xbutton.time);
294 XSendEvent(server
.dsp
, e
->xbutton
.window
, False
, ButtonPressMask
, e
);
298 void event_button_press (XEvent
*e
)
300 Panel
*panel
= get_panel(e
->xany
.window
);
304 if (wm_menu
&& !tint2_handles_click(panel
, &e
->xbutton
) ) {
308 task_drag
= click_task(panel
, e
->xbutton
.x
, e
->xbutton
.y
);
310 XLowerWindow (server
.dsp
, panel
->main_win
);
313 void event_button_motion_notify (XEvent
*e
)
315 Panel
* panel
= get_panel(e
->xany
.window
);
316 if(!panel
|| !task_drag
)
319 // Find the taskbar on the event's location
320 Taskbar
* event_taskbar
= click_taskbar(panel
, e
->xbutton
.x
, e
->xbutton
.y
);
321 if(event_taskbar
== NULL
)
324 // Find the task on the event's location
325 Task
* event_task
= click_task(panel
, e
->xbutton
.x
, e
->xbutton
.y
);
327 // If the event takes place on the same taskbar as the task being dragged
328 if(event_taskbar
== task_drag
->area
.parent
) {
329 // Swap the task_drag with the task on the event's location (if they differ)
330 if(event_task
&& event_task
!= task_drag
) {
331 GSList
* drag_iter
= g_slist_find(event_taskbar
->area
.list
, task_drag
);
332 GSList
* task_iter
= g_slist_find(event_taskbar
->area
.list
, event_task
);
333 if(drag_iter
&& task_iter
) {
334 gpointer temp
= task_iter
->data
;
335 task_iter
->data
= drag_iter
->data
;
336 drag_iter
->data
= temp
;
337 event_taskbar
->area
.resize
= 1;
343 else { // The event is on another taskbar than the task being dragged
344 if(task_drag
->desktop
== ALLDESKTOP
|| panel_mode
!= MULTI_DESKTOP
)
347 Taskbar
* drag_taskbar
= (Taskbar
*)task_drag
->area
.parent
;
348 drag_taskbar
->area
.list
= g_slist_remove(drag_taskbar
->area
.list
, task_drag
);
350 if(event_taskbar
->area
.posx
> drag_taskbar
->area
.posx
|| event_taskbar
->area
.posy
> drag_taskbar
->area
.posy
)
351 event_taskbar
->area
.list
= g_slist_prepend(event_taskbar
->area
.list
, task_drag
);
353 event_taskbar
->area
.list
= g_slist_append(event_taskbar
->area
.list
, task_drag
);
355 // Move task to other desktop (but avoid the 'Window desktop changed' code in 'event_property_notify')
356 task_drag
->area
.parent
= event_taskbar
;
357 task_drag
->desktop
= event_taskbar
->desktop
;
359 windows_set_desktop(task_drag
->win
, event_taskbar
->desktop
);
361 event_taskbar
->area
.resize
= 1;
362 drag_taskbar
->area
.resize
= 1;
368 void event_button_release (XEvent
*e
)
370 Panel
*panel
= get_panel(e
->xany
.window
);
373 if (wm_menu
&& !tint2_handles_click(panel
, &e
->xbutton
)) {
375 XLowerWindow (server
.dsp
, panel
->main_win
);
380 int action
= TOGGLE_ICONIFY
;
381 switch (e
->xbutton
.button
) {
383 action
= mouse_middle
;
386 action
= mouse_right
;
389 action
= mouse_scroll_up
;
392 action
= mouse_scroll_down
;
395 action
= mouse_tilt_left
;
398 action
= mouse_tilt_right
;
402 if ( click_clock(panel
, e
->xbutton
.x
, e
->xbutton
.y
)) {
403 clock_action(e
->xbutton
.button
);
404 XLowerWindow (server
.dsp
, panel
->main_win
);
410 if ( !(tskbar
= click_taskbar(panel
, e
->xbutton
.x
, e
->xbutton
.y
)) ) {
411 // TODO: check better solution to keep window below
412 XLowerWindow (server
.dsp
, panel
->main_win
);
417 // drag and drop task
425 if (panel_mode
== MULTI_DESKTOP
) {
426 if (tskbar
->desktop
!= server
.desktop
&& action
!= CLOSE
&& action
!= DESKTOP_LEFT
&& action
!= DESKTOP_RIGHT
)
427 set_desktop (tskbar
->desktop
);
431 window_action( click_task(panel
, e
->xbutton
.x
, e
->xbutton
.y
), action
);
433 // to keep window below
434 XLowerWindow (server
.dsp
, panel
->main_win
);
438 void event_property_notify (XEvent
*e
)
442 Window win
= e
->xproperty
.window
;
443 Atom at
= e
->xproperty
.atom
;
445 if (win
== server
.root_win
) {
446 if (!server
.got_root_win
) {
447 XSelectInput (server
.dsp
, server
.root_win
, PropertyChangeMask
|StructureNotifyMask
);
448 server
.got_root_win
= 1;
451 // Change number of desktops
452 else if (at
== server
.atom
._NET_NUMBER_OF_DESKTOPS
) {
453 server
.nb_desktop
= server_get_number_of_desktop ();
457 for (i
=0 ; i
< nb_panel
; i
++) {
458 panel1
[i
].area
.resize
= 1;
460 task_refresh_tasklist();
465 else if (at
== server
.atom
._NET_CURRENT_DESKTOP
) {
466 int old_desktop
= server
.desktop
;
467 server
.desktop
= server_get_current_desktop ();
468 for (i
=0 ; i
< nb_panel
; i
++) {
469 Panel
*panel
= &panel1
[i
];
470 if (panel_mode
== MULTI_DESKTOP
&& panel
->g_taskbar
.use_active
) {
471 // redraw both taskbar
472 if (server
.nb_desktop
> old_desktop
) {
473 // can happen if last desktop is deleted and we've been on the last desktop
474 panel
->taskbar
[old_desktop
].area
.bg
= panel
->g_taskbar
.bg
;
475 panel
->taskbar
[old_desktop
].area
.resize
= 1;
477 panel
->taskbar
[server
.desktop
].area
.bg
= panel
->g_taskbar
.bg_active
;
478 panel
->taskbar
[server
.desktop
].area
.resize
= 1;
481 // check ALLDESKTOP task => resize taskbar
485 if (server
.nb_desktop
> old_desktop
) {
486 tskbar
= &panel
->taskbar
[old_desktop
];
487 for (l
= tskbar
->area
.list
; l
; l
= l
->next
) {
489 if (tsk
->desktop
== ALLDESKTOP
) {
490 tsk
->area
.on_screen
= 0;
491 tskbar
->area
.resize
= 1;
496 tskbar
= &panel
->taskbar
[server
.desktop
];
497 for (l
= tskbar
->area
.list
; l
; l
= l
->next
) {
499 if (tsk
->desktop
== ALLDESKTOP
) {
500 tsk
->area
.on_screen
= 1;
501 tskbar
->area
.resize
= 1;
505 if (panel_mode
!= MULTI_DESKTOP
) {
510 else if (at
== server
.atom
._NET_CLIENT_LIST
) {
511 task_refresh_tasklist();
515 else if (at
== server
.atom
._NET_ACTIVE_WINDOW
) {
519 else if (at
== server
.atom
._XROOTPMAP_ID
) {
521 for (i
=0 ; i
< nb_panel
; i
++) {
522 set_panel_background(&panel1
[i
]);
528 tsk
= task_get_task (win
);
530 if (at
!= server
.atom
._NET_WM_STATE
)
533 // xfce4 sends _NET_WM_STATE after minimized to tray, so we need to check if window is mapped
534 // if it is mapped and not set as skip_taskbar, we must add it to our task list
535 XWindowAttributes wa
;
536 XGetWindowAttributes(server
.dsp
, win
, &wa
);
537 if (wa
.map_state
== IsViewable
&& !window_is_skip_taskbar(win
)) {
538 if ( (tsk
= add_task(win
)) )
547 //printf("atom root_win = %s, %s\n", XGetAtomName(server.dsp, at), tsk->title);
549 // Window title changed
550 if (at
== server
.atom
._NET_WM_VISIBLE_NAME
|| at
== server
.atom
._NET_WM_NAME
|| at
== server
.atom
.WM_NAME
) {
552 if (g_tooltip
.mapped
&& (g_tooltip
.area
== (Area
*)tsk
)) {
553 tooltip_copy_text((Area
*)tsk
);
559 else if (at
== server
.atom
._NET_WM_STATE
) {
560 if (window_is_urgent (win
)) {
563 if (window_is_skip_taskbar(win
)) {
568 else if (at
== server
.atom
.WM_STATE
) {
570 int state
= (task_active
&& tsk
->win
== task_active
->win
? TASK_ACTIVE
: TASK_NORMAL
);
571 if (window_is_iconified(win
))
572 state
= TASK_ICONIFIED
;
573 set_task_state(tsk
, state
);
576 // Window icon changed
577 else if (at
== server
.atom
._NET_WM_ICON
) {
581 // Window desktop changed
582 else if (at
== server
.atom
._NET_WM_DESKTOP
) {
583 int desktop
= window_get_desktop (win
);
584 //printf(" Window desktop changed %d, %d\n", tsk->desktop, desktop);
585 // bug in windowmaker : send unecessary 'desktop changed' when focus changed
586 if (desktop
!= tsk
->desktop
) {
588 tsk
= add_task (win
);
593 else if (at
== server
.atom
.WM_HINTS
) {
594 XWMHints
* wmhints
= XGetWMHints(server
.dsp
, win
);
595 if (wmhints
&& wmhints
->flags
& XUrgencyHint
) {
601 if (!server
.got_root_win
) server
.root_win
= RootWindow (server
.dsp
, server
.screen
);
606 void event_expose (XEvent
*e
)
609 panel
= get_panel(e
->xany
.window
);
611 // TODO : one panel_refresh per panel ?
616 void event_configure_notify (Window win
)
618 // change in root window (xrandr)
619 if (win
== server
.root_win
) {
622 config_read_file (config_path
);
628 // 'win' is a trayer icon
631 for (l
= systray
.list_icons
; l
; l
= l
->next
) {
632 traywin
= (TrayWindow
*)l
->data
;
633 if (traywin
->tray_id
== win
) {
634 //printf("move tray %d\n", traywin->x);
635 XMoveResizeWindow(server
.dsp
, traywin
->id
, traywin
->x
, traywin
->y
, traywin
->width
, traywin
->height
);
636 XResizeWindow(server
.dsp
, traywin
->tray_id
, traywin
->width
, traywin
->height
);
642 // 'win' move in another monitor
643 if (nb_panel
== 1) return;
644 Task
*tsk
= task_get_task (win
);
647 Panel
*p
= tsk
->area
.panel
;
648 if (p
->monitor
!= window_get_monitor (win
)) {
650 tsk
= add_task (win
);
651 if (win
== window_get_active ()) {
652 set_task_state(tsk
, TASK_ACTIVE
);
660 void dnd_message(XClientMessageEvent
*e
)
662 Panel
*panel
= get_panel(e
->window
);
663 int x
, y
, mapX
, mapY
;
665 x
= (e
->data
.l
[2] >> 16) & 0xFFFF;
666 y
= e
->data
.l
[2] & 0xFFFF;
667 XTranslateCoordinates(server
.dsp
, server
.root_win
, e
->window
, x
, y
, &mapX
, &mapY
, &child
);
668 Task
* task
= click_task(panel
, mapX
, mapY
);
670 if (task
->desktop
!= server
.desktop
)
671 set_desktop (task
->desktop
);
672 window_action(task
, TOGGLE
);
675 // send XdndStatus event to get more XdndPosition events
676 XClientMessageEvent se
;
677 se
.type
= ClientMessage
;
678 se
.window
= e
->data
.l
[0];
679 se
.message_type
= server
.atom
.XdndStatus
;
681 se
.data
.l
[0] = e
->window
; // XID of the target window
682 se
.data
.l
[1] = 0; // bit 0: accept drop bit 1: send XdndPosition events if inside rectangle
683 se
.data
.l
[2] = 0; // Rectangle x,y for which no more XdndPosition events
684 se
.data
.l
[3] = (1 << 16) | 1; // Rectangle w,h for which no more XdndPosition events
685 se
.data
.l
[4] = None
; // None = drop will not be accepted
686 XSendEvent(server
.dsp
, e
->data
.l
[0], False
, NoEventMask
, (XEvent
*)&se
);
690 int main (int argc
, char *argv
[])
693 XClientMessageEvent
*ev
;
698 struct timeval
* timeout
;
706 i
= config_read_file (config_path
);
710 fprintf(stderr
, "usage: tint2 [-c] <config_file>\n");
718 get_snapshot(snapshot_path
);
723 int damage_event
, damage_error
;
724 XDamageQueryExtension(server
.dsp
, &damage_event
, &damage_error
);
725 x11_fd
= ConnectionNumber(server
.dsp
);
726 XSync(server
.dsp
, False
);
728 // sigset_t empty_mask;
729 // sigemptyset(&empty_mask);
735 for (i
=0 ; i
< nb_panel
; i
++) {
738 if (panel
->is_hidden
) {
739 XCopyArea(server
.dsp
, panel
->hidden_pixmap
, panel
->main_win
, server
.gc
, 0, 0, panel
->hidden_width
, panel
->hidden_height
, 0, 0);
740 XSetWindowBackgroundPixmap(server
.dsp
, panel
->main_win
, panel
->hidden_pixmap
);
743 if (panel
->temp_pmap
) XFreePixmap(server
.dsp
, panel
->temp_pmap
);
744 panel
->temp_pmap
= XCreatePixmap(server
.dsp
, server
.root_win
, panel
->area
.width
, panel
->area
.height
, server
.depth
);
745 refresh(&panel
->area
);
746 XCopyArea(server
.dsp
, panel
->temp_pmap
, panel
->main_win
, server
.gc
, 0, 0, panel
->area
.width
, panel
->area
.height
, 0, 0);
751 panel
= (Panel
*)systray
.area
.panel
;
752 if (refresh_systray
&& panel
&& !panel
->is_hidden
) {
754 // tint2 doen't draw systray icons. it just redraw background.
755 XSetWindowBackgroundPixmap (server
.dsp
, panel
->main_win
, panel
->temp_pmap
);
756 // force icon's refresh
757 refresh_systray_icon();
761 // thanks to AngryLlama for the timer
762 // Create a File Description Set containing x11_fd
764 FD_SET (x11_fd
, &fdset
);
765 update_next_timeout();
766 if (next_timeout
.tv_sec
>= 0 && next_timeout
.tv_usec
>= 0)
767 timeout
= &next_timeout
;
771 // Wait for X Event or a Timer
772 if (select(x11_fd
+1, &fdset
, 0, 0, timeout
) > 0) {
773 while (XPending (server
.dsp
)) {
774 XNextEvent(server
.dsp
, &e
);
776 panel
= get_panel(e
.xany
.window
);
777 if (panel
&& panel_autohide
) {
778 if (e
.type
== EnterNotify
)
779 autohide_trigger_show(panel
);
780 else if (e
.type
== LeaveNotify
)
781 autohide_trigger_hide(panel
);
782 if (panel
->is_hidden
)
783 continue; // discard further processing of this event because the panel is not visible yet
789 event_button_press (&e
);
793 event_button_release(&e
);
797 unsigned int button_mask
= Button1Mask
| Button2Mask
| Button3Mask
| Button4Mask
| Button5Mask
;
798 if (e
.xmotion
.state
& button_mask
)
799 event_button_motion_notify (&e
);
801 if (!g_tooltip
.enabled
) break;
802 Panel
* panel
= get_panel(e
.xmotion
.window
);
803 Area
* area
= click_area(panel
, e
.xmotion
.x
, e
.xmotion
.y
);
804 if (area
->_get_tooltip_text
)
805 tooltip_trigger_show(area
, panel
, e
.xmotion
.x_root
, e
.xmotion
.y_root
);
807 tooltip_trigger_hide();
812 if (g_tooltip
.enabled
)
813 tooltip_trigger_hide();
821 event_property_notify(&e
);
824 case ConfigureNotify
:
825 event_configure_notify (e
.xconfigure
.window
);
829 if (!systray_enabled
)
831 panel
= (Panel
*)systray
.area
.panel
;
832 if (e
.xany
.window
== panel
->main_win
) // reparented to us
834 // FIXME: 'reparent to us' badly detected => disabled
838 if (e
.xany
.window
== server
.composite_manager
) {
839 // TODO: Stop real_transparency
840 //signal_pending = SIGUSR2;
843 if (e
.xany
.window
== g_tooltip
.window
|| !systray
.area
.on_screen
)
845 for (it
= systray
.list_icons
; it
; it
= g_slist_next(it
)) {
846 if (((TrayWindow
*)it
->data
)->tray_id
== e
.xany
.window
) {
847 remove_icon((TrayWindow
*)it
->data
);
855 if (ev
->data
.l
[1] == server
.atom
._NET_WM_CM_S0
) {
856 if (ev
->data
.l
[2] == None
)
857 // TODO: Stop real_transparency
858 //signal_pending = SIGUSR2;
861 // TODO: Start real_transparency
862 //signal_pending = SIGUSR2;
865 if (!systray
.area
.on_screen
) break;
866 if (e
.xclient
.message_type
== server
.atom
._NET_SYSTEM_TRAY_OPCODE
&& e
.xclient
.format
== 32 && e
.xclient
.window
== net_sel_win
) {
867 net_message(&e
.xclient
);
869 else if (e
.xclient
.message_type
== server
.atom
.XdndPosition
) {
870 dnd_message(&e
.xclient
);
875 if (e
.type
== XDamageNotify
+damage_event
) {
876 // union needed to avoid strict-aliasing warnings by gcc
877 union { XEvent e
; XDamageNotifyEvent de
; } event_union
= {.e
=e
};
880 XDamageNotifyEvent
* de
= &event_union
.de
;
881 for (l
= systray
.list_icons
; l
; l
= l
->next
) {
882 traywin
= (TrayWindow
*)l
->data
;
883 if ( traywin
->id
== de
->drawable
) {
884 systray_render_icon(traywin
);
893 callback_timeout_expired();
895 switch (signal_pending
) {
896 case SIGUSR1
: // reload config file
899 config_read_file (config_path
);
This page took 0.079576 seconds and 4 git commands to generate.