From 3a6fc52fb836affe45da6700925767de7a4edf95 Mon Sep 17 00:00:00 2001 From: Daniel Narvaez Date: Tue, 04 Dec 2012 17:29:23 +0000 Subject: Better workaround for the fullscreen race --- diff --git a/sugar-runner-window.c b/sugar-runner-window.c index 9d21b0c..8590056 100644 --- a/sugar-runner-window.c +++ b/sugar-runner-window.c @@ -6,6 +6,7 @@ static Display *display = NULL; static Window window = 0; static Atom wm_delete_window; +static gboolean is_fullscreen = FALSE; void sugar_runner_window_create(int width, int height, gboolean fullscreen) @@ -21,6 +22,8 @@ sugar_runner_window_create(int width, int height, gboolean fullscreen) window = XCreateSimpleWindow(display, root_window, 0, 0, width, height, 0, 0, 0); + XSelectInput (display, window, StructureNotifyMask); + if (fullscreen) { Atom atom; @@ -44,6 +47,12 @@ sugar_runner_window_wait(void) XNextEvent(display, &event); + if (event.type == ConfigureNotify) { + XConfigureEvent configure_event = event.xconfigure; + is_fullscreen = (DisplayWidth(display, 0) == configure_event.width && + DisplayHeight(display, 0) == configure_event.height); + } + if (event.type == ClientMessage && event.xclient.data.l[0] == wm_delete_window) { XCloseDisplay(display); @@ -53,6 +62,12 @@ sugar_runner_window_wait(void) return TRUE; } +gboolean +sugar_runner_window_is_fullscreen(void) +{ + return is_fullscreen; +} + unsigned long sugar_runner_window_get_xid(void) { diff --git a/sugar-runner-window.h b/sugar-runner-window.h index d78ed19..02f0943 100644 --- a/sugar-runner-window.h +++ b/sugar-runner-window.h @@ -5,11 +5,12 @@ G_BEGIN_DECLS -void sugar_runner_window_create (int width, - int height, - gboolean fullscreen); -gboolean sugar_runner_window_wait (void); -unsigned long sugar_runner_window_get_xid (void); +void sugar_runner_window_create (int width, + int height, + gboolean fullscreen); +gboolean sugar_runner_window_wait (void); +gboolean sugar_runner_window_is_fullscreen (void); +unsigned long sugar_runner_window_get_xid (void); G_END_DECLS diff --git a/sugar-runner.in b/sugar-runner.in index 4437055..ce65049 100644 --- a/sugar-runner.in +++ b/sugar-runner.in @@ -114,9 +114,6 @@ elif "DISPLAY" in os.environ: window_process, xid = _run_xephyr_window(args.resolution) - # FIXME if Xephyr runs immediately it doesn't get the full screen size - time.sleep(1) - xinit_args.append("/usr/bin/Xephyr") xinit_args.append(display) xinit_args.extend(["-dpi", str(_get_screen_dpi())]) -- cgit v0.9.1