Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/commands/helpers
diff options
context:
space:
mode:
authorDaniel Narvaez <dwnarvaez@gmail.com>2012-11-19 15:54:24 (GMT)
committer Daniel Narvaez <dwnarvaez@gmail.com>2012-11-19 15:54:24 (GMT)
commita3de3e6ad1aae1f7bb2c718eebd1d635e6717916 (patch)
tree2d6ac03fb0ff7ea01b7a137387da8a2f52a746cd /commands/helpers
parenta96a6091c87492f56fe3f1169bf7608c2fa3d05c (diff)
Run xephyr in a custom window
Xephyr doesn't work very well with multiple outputs. This should allow us to customize our behavior in that case.
Diffstat (limited to 'commands/helpers')
-rwxr-xr-xcommands/helpers/xephyr-window.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/commands/helpers/xephyr-window.c b/commands/helpers/xephyr-window.c
new file mode 100755
index 0000000..b711f99
--- /dev/null
+++ b/commands/helpers/xephyr-window.c
@@ -0,0 +1,58 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+
+int main(int argc, char **argv)
+{
+ Display *display = XOpenDisplay(NULL);
+ Window window, root_window;
+ Atom atom;
+ int width = 100, height = 100;
+
+ if (argc > 1) {
+ char *geometry = strdup(argv[1]);
+ char *delimiter = strchr(geometry, 'x');
+
+ if (delimiter == NULL) {
+ fprintf(stderr, "Cannot parse geometry\n");
+ free(geometry);
+ exit(1);
+ }
+
+ *delimiter = '\0';
+ width = atoi(geometry);
+ height = atoi(delimiter + 1);
+
+ free(geometry);
+ }
+
+ root_window = RootWindow(display, 0);
+
+ window = XCreateSimpleWindow(display, root_window, 0, 0,
+ width, height, 0, 0, 0);
+
+ printf("%d\n", window);
+ fflush(stdout);
+
+ if (argc < 2) {
+ atom = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", True);
+ XChangeProperty(display, window,
+ XInternAtom(display, "_NET_WM_STATE", True),
+ XA_ATOM, 32, PropModeReplace,
+ (unsigned char *)&atom, 1);
+ }
+
+ XMapWindow(display, window);
+
+ XFlush(display);
+
+ while(1) {
+ sleep(60);
+ }
+
+ XCloseDisplay(display);
+
+ return(0);
+}