]>
Dogcows Code - chaz/tint2/blob - src/tint.c
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"
46 void signal_handler(int sig
)
48 // signal handler is light as it should be
53 void init (int argc
, char *argv
[])
61 memset(&server
, 0, sizeof(Server_global
));
71 for (i
= 1; i
< argc
; ++i
) {
72 if (!strcmp(argv
[i
], "-h") || !strcmp(argv
[i
], "--help")) {
73 printf("Usage: tint2 [-c] <config_file>\n");
76 if (!strcmp(argv
[i
], "-v") || !strcmp(argv
[i
], "--version")) {
77 printf("tint2 version %s\n", VERSION_STRING
);
80 if (!strcmp(argv
[i
], "-c")) {
83 config_path
= strdup(argv
[i
]);
85 if (!strcmp(argv
[i
], "-s")) {
88 snapshot_path
= strdup(argv
[i
]);
93 struct sigaction sa
= { .sa_handler
= signal_handler
};
94 sigaction(SIGUSR1
, &sa
, 0);
95 sigaction(SIGINT
, &sa
, 0);
96 sigaction(SIGTERM
, &sa
, 0);
97 sigaction(SIGHUP
, &sa
, 0);
98 signal(SIGCHLD
, SIG_IGN
); // don't have to wait() after fork()
100 // BSD is too stupid to support pselect(), therefore we have to use select and hope that we do not
101 // end up in a race condition there
102 // block all signals, such that no race conditions occur before pselect in our main loop
103 // sigset_t block_mask;
104 // sigaddset(&block_mask, SIGINT);
105 // sigaddset(&block_mask, SIGTERM);
106 // sigaddset(&block_mask, SIGHUP);
107 // sigaddset(&block_mask, SIGUSR1);
108 // sigprocmask(SIG_BLOCK, &block_mask, 0);
113 server
.dsp
= XOpenDisplay (NULL
);
115 fprintf(stderr
, "tint2 exit : could not open display.\n");
118 server_init_atoms ();
119 server
.screen
= DefaultScreen (server
.dsp
);
120 server
.root_win
= RootWindow(server
.dsp
, server
.screen
);
121 server
.desktop
= server_get_current_desktop ();
122 server_init_visual();
123 XSetErrorHandler ((XErrorHandler
) server_catch_error
);
125 imlib_context_set_display (server
.dsp
);
126 imlib_context_set_visual (server
.visual
);
127 imlib_context_set_colormap (server
.colormap
);
130 XSelectInput (server
.dsp
, server
.root_win
, PropertyChangeMask
|StructureNotifyMask
);
132 setlocale (LC_ALL
, "");
136 const gchar
* const *data_dirs
;
137 data_dirs
= g_get_system_data_dirs ();
139 for (i
= 0; data_dirs
[i
] != NULL
; i
++) {
140 path
= g_build_filename(data_dirs
[i
], "tint2", "default_icon.png", NULL
);
141 if (g_file_test (path
, G_FILE_TEST_EXISTS
))
142 default_icon
= imlib_load_image(path
);
146 // get monitor and desktop config
159 #ifdef ENABLE_BATTERY
165 imlib_context_set_image(default_icon
);
168 imlib_context_disconnect_display();
171 if (server
.dsp
) XCloseDisplay(server
.dsp
);
175 void get_snapshot(const char *path
)
177 Panel
*panel
= &panel1
[0];
179 if (panel
->area
.width
> server
.monitor
[0].width
)
180 panel
->area
.width
= server
.monitor
[0].width
;
182 panel
->temp_pmap
= XCreatePixmap(server
.dsp
, server
.root_win
, panel
->area
.width
, panel
->area
.height
, server
.depth
);
183 refresh(&panel
->area
);
185 Imlib_Image img
= NULL
;
186 imlib_context_set_drawable(panel
->temp_pmap
);
187 img
= imlib_create_image_from_drawable(0, 0, 0, panel
->area
.width
, panel
->area
.height
, 0);
189 imlib_context_set_image(img
);
190 if (!panel_horizontal
) {
191 // rotate 90° vertical panel
192 imlib_image_flip_horizontal();
193 imlib_image_flip_diagonal();
195 imlib_save_image(path
);
200 void window_action (Task
*tsk
, int action
)
206 set_close (tsk
->win
);
209 set_active(tsk
->win
);
212 XIconifyWindow (server
.dsp
, tsk
->win
, server
.screen
);
215 if (task_active
&& tsk
->win
== task_active
->win
)
216 XIconifyWindow (server
.dsp
, tsk
->win
, server
.screen
);
218 set_active (tsk
->win
);
221 window_toggle_shade (tsk
->win
);
223 case MAXIMIZE_RESTORE
:
224 window_maximize_restore (tsk
->win
);
227 window_maximize_restore (tsk
->win
);
230 window_maximize_restore (tsk
->win
);
233 if ( tsk
->desktop
== 0 ) break;
234 desk
= tsk
->desktop
- 1;
235 windows_set_desktop(tsk
->win
, desk
);
236 if (desk
== server
.desktop
)
237 set_active(tsk
->win
);
240 if (tsk
->desktop
== server
.nb_desktop
) break;
241 desk
= tsk
->desktop
+ 1;
242 windows_set_desktop(tsk
->win
, desk
);
243 if (desk
== server
.desktop
)
244 set_active(tsk
->win
);
249 tsk1
= next_task(task_active
);
250 set_active(tsk1
->win
);
256 tsk1
= prev_task(task_active
);
257 set_active(tsk1
->win
);
263 int tint2_handles_click(Panel
* panel
, XButtonEvent
* e
)
265 Task
* task
= click_task(panel
, e
->x
, e
->y
);
268 || (e
->button
== 2 && mouse_middle
!= 0)
269 || (e
->button
== 3 && mouse_right
!= 0)
270 || (e
->button
== 4 && mouse_scroll_up
!= 0)
271 || (e
->button
== 5 && mouse_scroll_down
!=0) )
278 // no task clicked --> check if taskbar clicked
279 Taskbar
*tskbar
= click_taskbar(panel
, e
->x
, e
->y
);
280 if (tskbar
&& e
->button
== 1 && panel_mode
== MULTI_DESKTOP
)
282 if (click_clock(panel
, e
->x
, e
->y
)) {
283 if ( (e
->button
== 1 && clock_lclick_command
) || (e
->button
== 3 && clock_rclick_command
) )
292 void forward_click(XEvent
* e
)
294 // forward the click to the desktop window (thanks conky)
295 XUngrabPointer(server
.dsp
, e
->xbutton
.time
);
296 e
->xbutton
.window
= server
.root_win
;
297 // icewm doesn't open under the mouse.
298 // and xfce doesn't open at all.
299 e
->xbutton
.x
= e
->xbutton
.x_root
;
300 e
->xbutton
.y
= e
->xbutton
.y_root
;
301 //printf("**** %d, %d\n", e->xbutton.x, e->xbutton.y);
302 //XSetInputFocus(server.dsp, e->xbutton.window, RevertToParent, e->xbutton.time);
303 XSendEvent(server
.dsp
, e
->xbutton
.window
, False
, ButtonPressMask
, e
);
307 void event_button_press (XEvent
*e
)
309 Panel
*panel
= get_panel(e
->xany
.window
);
313 if (wm_menu
&& !tint2_handles_click(panel
, &e
->xbutton
) ) {
317 task_drag
= click_task(panel
, e
->xbutton
.x
, e
->xbutton
.y
);
319 XLowerWindow (server
.dsp
, panel
->main_win
);
322 void event_button_motion_notify (XEvent
*e
)
324 Panel
* panel
= get_panel(e
->xany
.window
);
325 if(!panel
|| !task_drag
)
328 // Find the taskbar on the event's location
329 Taskbar
* event_taskbar
= click_taskbar(panel
, e
->xbutton
.x
, e
->xbutton
.y
);
330 if(event_taskbar
== NULL
)
333 // Find the task on the event's location
334 Task
* event_task
= click_task(panel
, e
->xbutton
.x
, e
->xbutton
.y
);
336 // If the event takes place on the same taskbar as the task being dragged
337 if(event_taskbar
== task_drag
->area
.parent
) {
338 // Swap the task_drag with the task on the event's location (if they differ)
339 if(event_task
&& event_task
!= task_drag
) {
340 GSList
* drag_iter
= g_slist_find(event_taskbar
->area
.list
, task_drag
);
341 GSList
* task_iter
= g_slist_find(event_taskbar
->area
.list
, event_task
);
342 if(drag_iter
&& task_iter
) {
343 gpointer temp
= task_iter
->data
;
344 task_iter
->data
= drag_iter
->data
;
345 drag_iter
->data
= temp
;
346 event_taskbar
->area
.resize
= 1;
352 else { // The event is on another taskbar than the task being dragged
353 if(task_drag
->desktop
== ALLDESKTOP
|| panel_mode
!= MULTI_DESKTOP
)
356 Taskbar
* drag_taskbar
= (Taskbar
*)task_drag
->area
.parent
;
357 drag_taskbar
->area
.list
= g_slist_remove(drag_taskbar
->area
.list
, task_drag
);
359 if(event_taskbar
->area
.posx
> drag_taskbar
->area
.posx
|| event_taskbar
->area
.posy
> drag_taskbar
->area
.posy
)
360 event_taskbar
->area
.list
= g_slist_prepend(event_taskbar
->area
.list
, task_drag
);
362 event_taskbar
->area
.list
= g_slist_append(event_taskbar
->area
.list
, task_drag
);
364 // Move task to other desktop (but avoid the 'Window desktop changed' code in 'event_property_notify')
365 task_drag
->area
.parent
= event_taskbar
;
366 task_drag
->desktop
= event_taskbar
->desktop
;
368 windows_set_desktop(task_drag
->win
, event_taskbar
->desktop
);
370 event_taskbar
->area
.resize
= 1;
371 drag_taskbar
->area
.resize
= 1;
377 void event_button_release (XEvent
*e
)
379 Panel
*panel
= get_panel(e
->xany
.window
);
382 if (wm_menu
&& !tint2_handles_click(panel
, &e
->xbutton
)) {
384 XLowerWindow (server
.dsp
, panel
->main_win
);
389 int action
= TOGGLE_ICONIFY
;
390 switch (e
->xbutton
.button
) {
392 action
= mouse_middle
;
395 action
= mouse_right
;
398 action
= mouse_scroll_up
;
401 action
= mouse_scroll_down
;
404 action
= mouse_tilt_left
;
407 action
= mouse_tilt_right
;
411 if ( click_clock(panel
, e
->xbutton
.x
, e
->xbutton
.y
)) {
412 clock_action(e
->xbutton
.button
);
413 XLowerWindow (server
.dsp
, panel
->main_win
);
419 if ( !(tskbar
= click_taskbar(panel
, e
->xbutton
.x
, e
->xbutton
.y
)) ) {
420 // TODO: check better solution to keep window below
421 XLowerWindow (server
.dsp
, panel
->main_win
);
426 // drag and drop task
434 if (panel_mode
== MULTI_DESKTOP
) {
435 if (tskbar
->desktop
!= server
.desktop
&& action
!= CLOSE
&& action
!= DESKTOP_LEFT
&& action
!= DESKTOP_RIGHT
)
436 set_desktop (tskbar
->desktop
);
440 window_action( click_task(panel
, e
->xbutton
.x
, e
->xbutton
.y
), action
);
442 // to keep window below
443 XLowerWindow (server
.dsp
, panel
->main_win
);
447 void event_property_notify (XEvent
*e
)
451 Window win
= e
->xproperty
.window
;
452 Atom at
= e
->xproperty
.atom
;
454 if (win
== server
.root_win
) {
455 if (!server
.got_root_win
) {
456 XSelectInput (server
.dsp
, server
.root_win
, PropertyChangeMask
|StructureNotifyMask
);
457 server
.got_root_win
= 1;
460 // Change number of desktops
461 else if (at
== server
.atom
._NET_NUMBER_OF_DESKTOPS
) {
462 server
.nb_desktop
= server_get_number_of_desktop ();
466 for (i
=0 ; i
< nb_panel
; i
++) {
467 panel1
[i
].area
.resize
= 1;
469 task_refresh_tasklist();
474 else if (at
== server
.atom
._NET_CURRENT_DESKTOP
) {
475 int old_desktop
= server
.desktop
;
476 server
.desktop
= server_get_current_desktop ();
477 for (i
=0 ; i
< nb_panel
; i
++) {
478 Panel
*panel
= &panel1
[i
];
479 if (panel_mode
== MULTI_DESKTOP
&& panel
->g_taskbar
.use_active
) {
480 // redraw both taskbar
481 if (server
.nb_desktop
> old_desktop
) {
482 // can happen if last desktop is deleted and we've been on the last desktop
483 panel
->taskbar
[old_desktop
].area
.bg
= panel
->g_taskbar
.bg
;
484 panel
->taskbar
[old_desktop
].area
.resize
= 1;
486 panel
->taskbar
[server
.desktop
].area
.bg
= panel
->g_taskbar
.bg_active
;
487 panel
->taskbar
[server
.desktop
].area
.resize
= 1;
490 // check ALLDESKTOP task => resize taskbar
494 if (server
.nb_desktop
> old_desktop
) {
495 tskbar
= &panel
->taskbar
[old_desktop
];
496 for (l
= tskbar
->area
.list
; l
; l
= l
->next
) {
498 if (tsk
->desktop
== ALLDESKTOP
) {
499 tsk
->area
.on_screen
= 0;
500 tskbar
->area
.resize
= 1;
505 tskbar
= &panel
->taskbar
[server
.desktop
];
506 for (l
= tskbar
->area
.list
; l
; l
= l
->next
) {
508 if (tsk
->desktop
== ALLDESKTOP
) {
509 tsk
->area
.on_screen
= 1;
510 tskbar
->area
.resize
= 1;
514 if (panel_mode
!= MULTI_DESKTOP
) {
519 else if (at
== server
.atom
._NET_CLIENT_LIST
) {
520 task_refresh_tasklist();
524 else if (at
== server
.atom
._NET_ACTIVE_WINDOW
) {
528 else if (at
== server
.atom
._XROOTPMAP_ID
) {
530 for (i
=0 ; i
< nb_panel
; i
++) {
531 set_panel_background(&panel1
[i
]);
537 tsk
= task_get_task (win
);
539 if (at
!= server
.atom
._NET_WM_STATE
)
542 // xfce4 sends _NET_WM_STATE after minimized to tray, so we need to check if window is mapped
543 // if it is mapped and not set as skip_taskbar, we must add it to our task list
544 XWindowAttributes wa
;
545 XGetWindowAttributes(server
.dsp
, win
, &wa
);
546 if (wa
.map_state
== IsViewable
&& !window_is_skip_taskbar(win
)) {
547 if ( (tsk
= add_task(win
)) )
556 //printf("atom root_win = %s, %s\n", XGetAtomName(server.dsp, at), tsk->title);
558 // Window title changed
559 if (at
== server
.atom
._NET_WM_VISIBLE_NAME
|| at
== server
.atom
._NET_WM_NAME
|| at
== server
.atom
.WM_NAME
) {
561 if (g_tooltip
.mapped
&& (g_tooltip
.area
== (Area
*)tsk
)) {
562 tooltip_copy_text((Area
*)tsk
);
568 else if (at
== server
.atom
._NET_WM_STATE
) {
569 if (window_is_urgent (win
)) {
572 if (window_is_skip_taskbar(win
)) {
577 else if (at
== server
.atom
.WM_STATE
) {
579 int state
= (task_active
&& tsk
->win
== task_active
->win
? TASK_ACTIVE
: TASK_NORMAL
);
580 if (window_is_iconified(win
))
581 state
= TASK_ICONIFIED
;
582 set_task_state(tsk
, state
);
585 // Window icon changed
586 else if (at
== server
.atom
._NET_WM_ICON
) {
590 // Window desktop changed
591 else if (at
== server
.atom
._NET_WM_DESKTOP
) {
592 int desktop
= window_get_desktop (win
);
593 //printf(" Window desktop changed %d, %d\n", tsk->desktop, desktop);
594 // bug in windowmaker : send unecessary 'desktop changed' when focus changed
595 if (desktop
!= tsk
->desktop
) {
597 tsk
= add_task (win
);
602 else if (at
== server
.atom
.WM_HINTS
) {
603 XWMHints
* wmhints
= XGetWMHints(server
.dsp
, win
);
604 if (wmhints
&& wmhints
->flags
& XUrgencyHint
) {
610 if (!server
.got_root_win
) server
.root_win
= RootWindow (server
.dsp
, server
.screen
);
615 void event_expose (XEvent
*e
)
618 panel
= get_panel(e
->xany
.window
);
620 // TODO : one panel_refresh per panel ?
625 void event_configure_notify (Window win
)
627 // change in root window (xrandr)
628 if (win
== server
.root_win
) {
629 signal_pending
= SIGUSR1
;
633 // 'win' is a trayer icon
636 for (l
= systray
.list_icons
; l
; l
= l
->next
) {
637 traywin
= (TrayWindow
*)l
->data
;
638 if (traywin
->tray_id
== win
) {
639 //printf("move tray %d\n", traywin->x);
640 XMoveResizeWindow(server
.dsp
, traywin
->id
, traywin
->x
, traywin
->y
, traywin
->width
, traywin
->height
);
641 XResizeWindow(server
.dsp
, traywin
->tray_id
, traywin
->width
, traywin
->height
);
647 // 'win' move in another monitor
648 if (nb_panel
== 1) return;
649 Task
*tsk
= task_get_task (win
);
652 Panel
*p
= tsk
->area
.panel
;
653 if (p
->monitor
!= window_get_monitor (win
)) {
655 tsk
= add_task (win
);
656 if (win
== window_get_active ()) {
657 set_task_state(tsk
, TASK_ACTIVE
);
665 void dnd_message(XClientMessageEvent
*e
)
667 Panel
*panel
= get_panel(e
->window
);
668 int x
, y
, mapX
, mapY
;
670 x
= (e
->data
.l
[2] >> 16) & 0xFFFF;
671 y
= e
->data
.l
[2] & 0xFFFF;
672 XTranslateCoordinates(server
.dsp
, server
.root_win
, e
->window
, x
, y
, &mapX
, &mapY
, &child
);
673 Task
* task
= click_task(panel
, mapX
, mapY
);
675 if (task
->desktop
!= server
.desktop
)
676 set_desktop (task
->desktop
);
677 window_action(task
, TOGGLE
);
680 // send XdndStatus event to get more XdndPosition events
681 XClientMessageEvent se
;
682 se
.type
= ClientMessage
;
683 se
.window
= e
->data
.l
[0];
684 se
.message_type
= server
.atom
.XdndStatus
;
686 se
.data
.l
[0] = e
->window
; // XID of the target window
687 se
.data
.l
[1] = 0; // bit 0: accept drop bit 1: send XdndPosition events if inside rectangle
688 se
.data
.l
[2] = 0; // Rectangle x,y for which no more XdndPosition events
689 se
.data
.l
[3] = (1 << 16) | 1; // Rectangle w,h for which no more XdndPosition events
690 se
.data
.l
[4] = None
; // None = drop will not be accepted
691 XSendEvent(server
.dsp
, e
->data
.l
[0], False
, NoEventMask
, (XEvent
*)&se
);
695 int main (int argc
, char *argv
[])
698 XClientMessageEvent
*ev
;
703 struct timeval
* timeout
;
711 i
= config_read_file (config_path
);
715 fprintf(stderr
, "usage: tint2 [-c] <config_file>\n");
722 get_snapshot(snapshot_path
);
727 int damage_event
, damage_error
;
728 XDamageQueryExtension(server
.dsp
, &damage_event
, &damage_error
);
729 x11_fd
= ConnectionNumber(server
.dsp
);
730 XSync(server
.dsp
, False
);
732 // sigset_t empty_mask;
733 // sigemptyset(&empty_mask);
739 for (i
=0 ; i
< nb_panel
; i
++) {
742 if (panel
->is_hidden
) {
743 XCopyArea(server
.dsp
, panel
->hidden_pixmap
, panel
->main_win
, server
.gc
, 0, 0, panel
->hidden_width
, panel
->hidden_height
, 0, 0);
744 XSetWindowBackgroundPixmap(server
.dsp
, panel
->main_win
, panel
->hidden_pixmap
);
747 if (panel
->temp_pmap
) XFreePixmap(server
.dsp
, panel
->temp_pmap
);
748 panel
->temp_pmap
= XCreatePixmap(server
.dsp
, server
.root_win
, panel
->area
.width
, panel
->area
.height
, server
.depth
);
749 refresh(&panel
->area
);
750 XCopyArea(server
.dsp
, panel
->temp_pmap
, panel
->main_win
, server
.gc
, 0, 0, panel
->area
.width
, panel
->area
.height
, 0, 0);
755 panel
= (Panel
*)systray
.area
.panel
;
756 if (refresh_systray
&& panel
&& !panel
->is_hidden
) {
758 // tint2 doen't draw systray icons. it just redraw background.
759 XSetWindowBackgroundPixmap (server
.dsp
, panel
->main_win
, panel
->temp_pmap
);
760 // force icon's refresh
761 refresh_systray_icon();
765 // thanks to AngryLlama for the timer
766 // Create a File Description Set containing x11_fd
768 FD_SET (x11_fd
, &fdset
);
769 update_next_timeout();
770 if (next_timeout
.tv_sec
>= 0 && next_timeout
.tv_usec
>= 0)
771 timeout
= &next_timeout
;
775 // Wait for X Event or a Timer
776 if (select(x11_fd
+1, &fdset
, 0, 0, timeout
) > 0) {
777 while (XPending (server
.dsp
)) {
778 XNextEvent(server
.dsp
, &e
);
780 panel
= get_panel(e
.xany
.window
);
781 if (panel
&& panel_autohide
) {
782 if (e
.type
== EnterNotify
)
783 autohide_trigger_show(panel
);
784 else if (e
.type
== LeaveNotify
)
785 autohide_trigger_hide(panel
);
786 if (panel
->is_hidden
)
787 continue; // discard further processing of this event because the panel is not visible yet
793 event_button_press (&e
);
797 event_button_release(&e
);
801 unsigned int button_mask
= Button1Mask
| Button2Mask
| Button3Mask
| Button4Mask
| Button5Mask
;
802 if (e
.xmotion
.state
& button_mask
)
803 event_button_motion_notify (&e
);
805 if (!g_tooltip
.enabled
) break;
806 Panel
* panel
= get_panel(e
.xmotion
.window
);
807 Area
* area
= click_area(panel
, e
.xmotion
.x
, e
.xmotion
.y
);
808 if (area
->_get_tooltip_text
)
809 tooltip_trigger_show(area
, panel
, e
.xmotion
.x_root
, e
.xmotion
.y_root
);
811 tooltip_trigger_hide();
816 if (g_tooltip
.enabled
)
817 tooltip_trigger_hide();
825 event_property_notify(&e
);
828 case ConfigureNotify
:
829 event_configure_notify (e
.xconfigure
.window
);
833 if (!systray_enabled
)
835 panel
= (Panel
*)systray
.area
.panel
;
836 if (e
.xany
.window
== panel
->main_win
) // reparented to us
838 // FIXME: 'reparent to us' badly detected => disabled
842 if (e
.xany
.window
== server
.composite_manager
) {
843 // Stop real_transparency
844 signal_pending
= SIGUSR1
;
847 if (e
.xany
.window
== g_tooltip
.window
|| !systray
.area
.on_screen
)
849 for (it
= systray
.list_icons
; it
; it
= g_slist_next(it
)) {
850 if (((TrayWindow
*)it
->data
)->tray_id
== e
.xany
.window
) {
851 remove_icon((TrayWindow
*)it
->data
);
859 if (ev
->data
.l
[1] == server
.atom
._NET_WM_CM_S0
) {
860 if (ev
->data
.l
[2] == None
)
861 // Stop real_transparency
862 signal_pending
= SIGUSR1
;
864 // Start real_transparency
865 signal_pending
= SIGUSR1
;
867 if (!systray
.area
.on_screen
) break;
868 if (e
.xclient
.message_type
== server
.atom
._NET_SYSTEM_TRAY_OPCODE
&& e
.xclient
.format
== 32 && e
.xclient
.window
== net_sel_win
) {
869 net_message(&e
.xclient
);
871 else if (e
.xclient
.message_type
== server
.atom
.XdndPosition
) {
872 dnd_message(&e
.xclient
);
877 if (e
.type
== XDamageNotify
+damage_event
) {
878 // union needed to avoid strict-aliasing warnings by gcc
879 union { XEvent e
; XDamageNotifyEvent de
; } event_union
= {.e
=e
};
882 XDamageNotifyEvent
* de
= &event_union
.de
;
883 for (l
= systray
.list_icons
; l
; l
= l
->next
) {
884 traywin
= (TrayWindow
*)l
->data
;
885 if ( traywin
->id
== de
->drawable
) {
886 systray_render_icon(traywin
);
895 callback_timeout_expired();
897 if (signal_pending
) {
899 if (signal_pending
== SIGUSR1
) {
901 // SIGUSR1 used when : user's signal, composite manager stop/start or xrandr
902 FD_CLR (x11_fd
, &fdset
); // not sure if needed
906 // SIGINT, SIGTERM, SIGHUP
This page took 0.083011 seconds and 5 git commands to generate.