summaryrefslogtreecommitdiff
path: root/openbox
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-07-10 17:11:07 +0000
committerDana Jansens <danakj@orodu.net>2003-07-10 17:11:07 +0000
commit120623d34e0cb86b4970e9744a10ba39cd5e21b7 (patch)
tree4ee5246aad482be6215dd099867a5729ca3ef12c /openbox
parent85112c4d0831067251de1295fbb6974db94af2ba (diff)
use the xerror stuff to trap errors instead of dupliacted the effort here
Diffstat (limited to 'openbox')
-rw-r--r--openbox/screen.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/openbox/screen.c b/openbox/screen.c
index a83c5710..90c874ac 100644
--- a/openbox/screen.c
+++ b/openbox/screen.c
@@ -53,30 +53,22 @@ static void sn_event_func(SnMonitorEvent *event, void *data);
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()
{
- XErrorHandler old;
pid_t pid;
int i, num_support;
guint32 *supported;
- running = FALSE;
- old = XSetErrorHandler(another_running);
+ xerror_set_ignore(TRUE);
+ xerror_occured = FALSE;
XSelectInput(ob_display, ob_root, ROOT_EVENTMASK);
- XSync(ob_display, FALSE);
- XSetErrorHandler(old);
- if (running)
+ xerror_set_ignore(FALSE);
+ if (xerror_occured) {
+ g_message("A window manager is already running on screen %d",
+ ob_screen);
return FALSE;
+ }
+
g_message("Managing screen %d", ob_screen);