summaryrefslogtreecommitdiff
path: root/src/globals.c
diff options
context:
space:
mode:
authorMathieu OTHACEHE <m.othacehe@gmail.com>2016-11-12 17:58:24 +0100
committerJérémie Courrèges-Anglas <jca@wxcvbn.org>2016-11-17 11:26:11 +0100
commitb0839d05a60e59dfa2722e13586a4857a295d4fd (patch)
treeb73b797e5c2d49daf1dff7b9847826f56984abd7 /src/globals.c
parent710ce5f7d25c96fed0390227d75f28f0c662a1fa (diff)
downloadratpoison-b0839d05a60e59dfa2722e13586a4857a295d4fd.zip
Add xrandr support
Drop deprecated xinerama support and replace it with xrandr. Signed-off-by: Mathieu OTHACEHE <m.othacehe@gmail.com>
Diffstat (limited to 'src/globals.c')
-rw-r--r--src/globals.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/globals.c b/src/globals.c
index 1481a5c..23aee95 100644
--- a/src/globals.c
+++ b/src/globals.c
@@ -59,11 +59,14 @@ Atom _net_wm_window_type;
Atom _net_wm_window_type_dialog;
Atom _net_wm_name;
-int rp_current_screen;
-rp_screen *screens;
-int num_screens;
+LIST_HEAD (rp_screens);
+rp_screen *rp_current_screen;
+rp_global_screen rp_glob_screen;
+
Display *dpy;
+int rp_have_xrandr;
+
rp_group *rp_current_group;
LIST_HEAD (rp_groups);
LIST_HEAD (rp_children);
@@ -94,11 +97,17 @@ rp_xselection selection;
static void
x_export_selection (void)
{
+ rp_screen *screen;
+
+ list_first(screen, &rp_screens, node);
+ if (!screen)
+ return;
+
/* Hang the selections off screen 0's key window. */
- XSetSelectionOwner(dpy, XA_PRIMARY, screens[0].key_window, CurrentTime);
- if (XGetSelectionOwner(dpy, XA_PRIMARY) != screens[0].key_window)
+ XSetSelectionOwner (dpy, XA_PRIMARY, screen->key_window, CurrentTime);
+ if (XGetSelectionOwner (dpy, XA_PRIMARY) != screen->key_window)
PRINT_ERROR(("can't get primary selection"));
- XChangeProperty(dpy, screens[0].root, XA_CUT_BUFFER0, xa_string, 8,
+ XChangeProperty(dpy, screen->root, XA_CUT_BUFFER0, xa_string, 8,
PropModeReplace, (unsigned char*)selection.text, selection.len);
}
@@ -162,10 +171,10 @@ get_primary_selection(void)
struct sbuf *s = sbuf_new(0);
for (nread = 0, bytes_after = 1; bytes_after > 0; nread += ct.nitems) {
- if ((XGetWindowProperty(dpy, current_screen()->input_window, rp_selection, (nread / 4), 4096,
- True, AnyPropertyType, &ct.encoding,
- &ct.format, &ct.nitems, &bytes_after,
- &ct.value) != Success)) {
+ if ((XGetWindowProperty (dpy, rp_current_screen->input_window, rp_selection, (nread / 4), 4096,
+ True, AnyPropertyType, &ct.encoding,
+ &ct.format, &ct.nitems, &bytes_after,
+ &ct.value) != Success)) {
XFree(ct.value);
sbuf_free(s);
return NULL;
@@ -185,7 +194,7 @@ get_selection (void)
{
Atom property;
XEvent ev;
- rp_screen *s = current_screen ();
+ rp_screen *s = rp_current_screen;
int loops = 1000;
/* Just insert our text, if we own the selection. */