diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-04-12 01:37:18 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-04-12 01:37:18 +0200 |
commit | 1d6282a9226b0ae1ec866dd649764153458ca8d0 (patch) | |
tree | dab72590fff17abcf83a01bdc69680a2ac5cf31e | |
parent | use limits.h (diff) | |
download | blueshift-1d6282a9226b0ae1ec866dd649764153458ca8d0.tar.gz blueshift-1d6282a9226b0ae1ec866dd649764153458ca8d0.tar.bz2 blueshift-1d6282a9226b0ae1ec866dd649764153458ca8d0.tar.xz |
m + fix multiscreen bug
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | src/blueshift_iccprofile.c | 10 | ||||
-rw-r--r-- | src/blueshift_idcrtc.c | 10 | ||||
-rw-r--r-- | src/blueshift_randr_c.c | 5 |
4 files changed, 18 insertions, 15 deletions
@@ -46,7 +46,7 @@ EXECLIBS = $(foreach E,$(EXECS),blueshift_$(E)) # The installed pkg-config command PKGCONFIG ?= pkg-config # Optimisation settings for C code compilation -OPTIMISE ?= -Og -g +OPTIMISE ?= -O6 -g # Warnings settings for C code compilation WARN = -Wall -Wextra -pedantic -Wdouble-promotion -Wformat=2 -Winit-self -Wmissing-include-dirs \ -Wtrampolines -Wfloat-equal -Wmissing-prototypes -Wmissing-declarations -Wnested-externs \ @@ -55,11 +55,11 @@ WARN = -Wall -Wextra -pedantic -Wdouble-promotion -Wformat=2 -Winit-self -Wmissi -Wstrict-prototypes -Wold-style-definition -Wpacked -Wvector-operation-performance \ -Wunsuffixed-float-constants -Wsuggest-attribute=const -Wsuggest-attribute=noreturn \ -Wsuggest-attribute=format -Wnormalized=nfkc \ - -fstrict-aliasing -fstrict-overflow -fipa-pure-const -ftree-vrp -fstack-usage \ - -funsafe-loop-optimizations + -fstrict-aliasing -fipa-pure-const -ftree-vrp -fstack-usage -funsafe-loop-optimizations # Warnings violated by Cython and therefore only use for C and not Cython CWARN = -Wshadow -Wredundant-decls -Winline -Wcast-qual -Wsign-conversion -Wstrict-overflow=5 \ - -Wconversion -Wsuggest-attribute=pure -Wswitch-default -Wstrict-aliasing=1 + -Wconversion -Wsuggest-attribute=pure -Wswitch-default -Wstrict-aliasing=1 \ + -fstrict-overflow #not used: -Wtraditional (tranditional C function definitions are ridiculous), # -Wpadded (useless for this project), -Wc++-compat (bad practice) #not used because of libxcb's API: -Waggregate-return, -Wtraditional-conversion (also useless) diff --git a/src/blueshift_iccprofile.c b/src/blueshift_iccprofile.c index 99d5c42..e87a5c1 100644 --- a/src/blueshift_iccprofile.c +++ b/src/blueshift_iccprofile.c @@ -50,7 +50,6 @@ int main(int argc, char **argv) char* display = NULL; xcb_screen_iterator_t iter; int screen_count; - xcb_screen_t* screens; int screen_i; @@ -83,21 +82,22 @@ int main(int argc, char **argv) /* Acquire a list of all screens in the display, */ iter = xcb_setup_roots_iterator(xcb_get_setup(connection)); - /* count the list, */ + /* count the list. */ screen_count = iter.rem; - /* and start at the first screen. */ - screens = iter.data; for (screen_i = 0; screen_i < screen_count; screen_i++) { /* For each screen */ - xcb_screen_t* screen = screens + screen_i; + xcb_screen_t* screen = iter.data; xcb_list_properties_cookie_t list_cookie; xcb_list_properties_reply_t* list_reply; xcb_atom_t* atoms; xcb_atom_t* atoms_end; + /* We have acquired the screen, got to next in preperate for next iteration. */ + xcb_screen_next(&iter); + /* Get root window properties */ diff --git a/src/blueshift_idcrtc.c b/src/blueshift_idcrtc.c index 6bb0fff..6306096 100644 --- a/src/blueshift_idcrtc.c +++ b/src/blueshift_idcrtc.c @@ -66,7 +66,6 @@ int main(int argc, char** argv) xcb_randr_query_version_reply_t* randr_version; xcb_screen_iterator_t iter; int screen_count; - xcb_screen_t* screens; int screen_i; int i; @@ -119,23 +118,24 @@ int main(int argc, char** argv) /* Acquire a list of all screens in the display, */ iter = xcb_setup_roots_iterator(xcb_get_setup(connection)); - /* count the list, */ + /* count the list. */ screen_count = iter.rem; - /* and start at the first screen. */ - screens = iter.data; /* Print the number available screens. */ printf("Screen count: %i\n", screen_count); for (screen_i = 0; screen_i < screen_count; screen_i++) { /* For each screen */ - xcb_screen_t* screen = screens + screen_i; + xcb_screen_t* screen = iter.data; xcb_randr_get_screen_resources_current_cookie_t res_cookie; xcb_randr_get_screen_resources_current_reply_t* res_reply; xcb_randr_output_t* outputs; xcb_randr_crtc_t* crtcs; int output_i; + /* We have acquired the screen, got to next in preperate for next iteration. */ + xcb_screen_next(&iter); + /* Print the screen index. */ printf("Screen: %i\n", screen_i); diff --git a/src/blueshift_randr_c.c b/src/blueshift_randr_c.c index 0e38afc..eb3bdf1 100644 --- a/src/blueshift_randr_c.c +++ b/src/blueshift_randr_c.c @@ -65,6 +65,7 @@ int blueshift_randr_open(int use_screen, char* display) xcb_randr_get_crtc_gamma_size_reply_t* gamma_size_reply; xcb_randr_get_crtc_gamma_cookie_t gamma_get_cookie; xcb_randr_get_crtc_gamma_reply_t* gamma_get_reply; + int iter_i; @@ -101,7 +102,9 @@ int blueshift_randr_open(int use_screen, char* display) /* Get X resources */ iter = xcb_setup_roots_iterator(xcb_get_setup(connection)); - screen = iter.data + use_screen; + for (iter_i = 0; iter_i < use_screen; iter_i++) + xcb_screen_next(&iter); + screen = iter.data; res_cookie = xcb_randr_get_screen_resources_current(connection, screen->root); res_reply = xcb_randr_get_screen_resources_current_reply(connection, res_cookie, &error); |