use the xerror stuff to trap errors instead of dupliacted the effort here
This commit is contained in:
parent
85112c4d08
commit
120623d34e
1 changed files with 8 additions and 16 deletions
|
@ -53,30 +53,22 @@ static void sn_event_func(SnMonitorEvent *event, void *data);
|
||||||
|
|
||||||
static void set_root_cursor();
|
static void set_root_cursor();
|
||||||
|
|
||||||
static gboolean running;
|
|
||||||
static int another_running(Display *d, XErrorEvent *e)
|
|
||||||
{
|
|
||||||
(void)d;(void)e;
|
|
||||||
g_message("A window manager is already running on screen %d",
|
|
||||||
ob_screen);
|
|
||||||
running = TRUE;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean screen_annex()
|
gboolean screen_annex()
|
||||||
{
|
{
|
||||||
XErrorHandler old;
|
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int i, num_support;
|
int i, num_support;
|
||||||
guint32 *supported;
|
guint32 *supported;
|
||||||
|
|
||||||
running = FALSE;
|
xerror_set_ignore(TRUE);
|
||||||
old = XSetErrorHandler(another_running);
|
xerror_occured = FALSE;
|
||||||
XSelectInput(ob_display, ob_root, ROOT_EVENTMASK);
|
XSelectInput(ob_display, ob_root, ROOT_EVENTMASK);
|
||||||
XSync(ob_display, FALSE);
|
xerror_set_ignore(FALSE);
|
||||||
XSetErrorHandler(old);
|
if (xerror_occured) {
|
||||||
if (running)
|
g_message("A window manager is already running on screen %d",
|
||||||
|
ob_screen);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
g_message("Managing screen %d", ob_screen);
|
g_message("Managing screen %d", ob_screen);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue