Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Narvaez <dwnarvaez@gmail.com>2012-12-04 17:29:23 (GMT)
committer Daniel Narvaez <dwnarvaez@gmail.com>2012-12-04 17:29:23 (GMT)
commit3a6fc52fb836affe45da6700925767de7a4edf95 (patch)
treec0872a401eede2d4c9b141d69b0278ff9261ad85
parent6320c9d88c7794dc75f6b74f96a0d8c18b347803 (diff)
Better workaround for the fullscreen race
-rw-r--r--sugar-runner-window.c15
-rw-r--r--sugar-runner-window.h11
-rw-r--r--sugar-runner.in3
3 files changed, 21 insertions, 8 deletions
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())])