Nux

Merge lp:~smspillaz/nux/nux.fix_861341 into lp:nux

Proposed by Sam Spilsbury
Status: Merged
Merge reported by: Neil J. Patel
Merged at revision: not available
Proposed branch: lp:~smspillaz/nux/nux.fix_861341
Merge into: lp:nux
Diff against target: 162 lines (+68/-6)
6 files modified
NuxGraphics/GraphicsDisplayX11.cpp (+4/-0)
NuxGraphics/GraphicsDisplayX11.h (+2/-0)
NuxGraphics/XInputWindow.cpp (+59/-5)
NuxGraphics/XInputWindow.h (+1/-0)
NuxGraphics/nux-graphics.pc.in (+1/-1)
configure.ac (+1/-0)
To merge this branch: bzr merge lp:~smspillaz/nux/nux.fix_861341
Reviewer Review Type Date Requested Status
Jay Taoko (community) Approve
Review via email: mp+77318@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Jay Taoko (jaytaoko) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NuxGraphics/GraphicsDisplayX11.cpp'
--- NuxGraphics/GraphicsDisplayX11.cpp 2011-09-28 10:24:48 +0000
+++ NuxGraphics/GraphicsDisplayX11.cpp 2011-09-28 12:34:00 +0000
@@ -199,6 +199,8 @@
199 bool FullscreenFlag,199 bool FullscreenFlag,
200 bool create_rendering_data)200 bool create_rendering_data)
201 {201 {
202 int xinerama_event, xinerama_error;
203 int xinerama_major, xinerama_minor;
202 NScopeLock Scope (&CreateOpenGLWindow_CriticalSection);204 NScopeLock Scope (&CreateOpenGLWindow_CriticalSection);
203205
204 m_GfxInterfaceCreated = false;206 m_GfxInterfaceCreated = false;
@@ -223,6 +225,8 @@
223225
224 m_X11Screen = DefaultScreen (m_X11Display);226 m_X11Screen = DefaultScreen (m_X11Display);
225 XF86VidModeQueryVersion (m_X11Display, &_x11_major, &_x11_minor);227 XF86VidModeQueryVersion (m_X11Display, &_x11_major, &_x11_minor);
228 XineramaQueryVersion (m_X11Display, &xinerama_major, &xinerama_minor);
229 XineramaQueryExtension (m_X11Display, &xinerama_event, &xinerama_error);
226230
227 XF86VidModeGetAllModeLines (m_X11Display, m_X11Screen, &m_NumVideoModes, &m_X11VideoModes);231 XF86VidModeGetAllModeLines (m_X11Display, m_X11Screen, &m_NumVideoModes, &m_X11VideoModes);
228 m_X11OriginalVideoMode = *m_X11VideoModes[0];232 m_X11OriginalVideoMode = *m_X11VideoModes[0];
229233
=== modified file 'NuxGraphics/GraphicsDisplayX11.h'
--- NuxGraphics/GraphicsDisplayX11.h 2011-05-26 21:08:18 +0000
+++ NuxGraphics/GraphicsDisplayX11.h 2011-09-28 12:34:00 +0000
@@ -36,6 +36,7 @@
36#include <X11/keysym.h>36#include <X11/keysym.h>
3737
38#include <X11/extensions/xf86vmode.h>38#include <X11/extensions/xf86vmode.h>
39#include <X11/extensions/Xinerama.h>
3940
40namespace nux41namespace nux
41{42{
@@ -312,6 +313,7 @@
312 313
313 void * KeyboardGrabData () { return _global_keyboard_grab_data; }314 void * KeyboardGrabData () { return _global_keyboard_grab_data; }
314 void * PointerGrabData () { return _global_pointer_grab_data; }315 void * PointerGrabData () { return _global_pointer_grab_data; }
316
315 private:317 private:
316 void InitGlobalGrabWindow ();318 void InitGlobalGrabWindow ();
317 319
318320
=== modified file 'NuxGraphics/XInputWindow.cpp'
--- NuxGraphics/XInputWindow.cpp 2011-09-20 06:03:43 +0000
+++ NuxGraphics/XInputWindow.cpp 2011-09-28 12:34:00 +0000
@@ -103,15 +103,69 @@
103103
104 void XInputWindow::SetStruts()104 void XInputWindow::SetStruts()
105 {105 {
106 int screenHeight, screenWidth;106 int n_info;
107 XineramaScreenInfo *info = XineramaQueryScreens (display_, &n_info);
108 Region screen_region;
109 Region total_screen_region = XCreateRegion ();
110 Region input_window_region = XCreateRegion ();
111 Region intersection = XCreateRegion ();
112 XineramaScreenInfo monitor;
113 XRectangle tmp_rect;
114 int largestWidth = 0, largestHeight = 0;
115 int screenWidth, screenHeight;
107 long int data[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};116 long int data[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
108117
109 screenHeight = XDisplayHeight(display_, 0);118 /* Find the screen that this region intersects */
110 screenWidth = XDisplayWidth(display_, 0);119 tmp_rect.x = geometry_.x;
120 tmp_rect.y = geometry_.y;
121 tmp_rect.width = geometry_.width;
122 tmp_rect.height = geometry_.height;
123
124 XUnionRectWithRegion (&tmp_rect, input_window_region, input_window_region);
125
126 for (int i = 0; i < n_info; i++)
127 {
128 tmp_rect.x = info[i].x_org;
129 tmp_rect.y = info[i].y_org;
130 tmp_rect.width = info[i].width;
131 tmp_rect.height = info[i].height;
132
133 screen_region = XCreateRegion ();
134
135 XUnionRectWithRegion (&tmp_rect, screen_region, screen_region);
136 XUnionRegion (screen_region, total_screen_region, total_screen_region);
137 XIntersectRegion (screen_region, input_window_region, intersection);
138
139 if (!XEmptyRegion (intersection))
140 {
141 int width = intersection->extents.x2 - intersection->extents.x1;
142 int height = intersection->extents.y2 - intersection->extents.y1;
143
144 if ((width * height) > (largestWidth * largestHeight))
145 {
146 largestWidth = width;
147 largestHeight = height;
148
149 monitor = info[i];
150 }
151 }
152
153 XDestroyRegion (screen_region);
154 }
155
156 screenWidth = total_screen_region->extents.x2 - total_screen_region->extents.x1;
157 screenHeight = total_screen_region->extents.y2 - total_screen_region->extents.y1;
158
159 XDestroyRegion (input_window_region);
160 XDestroyRegion (intersection);
161 XDestroyRegion (total_screen_region);
162
163 if (info)
164 XFree (info);
111165
112 if (geometry_.width > geometry_.height)166 if (geometry_.width > geometry_.height)
113 {167 {
114 if (geometry_.y < screenHeight / 2)168 if (geometry_.y - monitor.y_org < monitor.height / 2)
115 {169 {
116 /* top */170 /* top */
117 data[2] = geometry_.y + geometry_.height;171 data[2] = geometry_.y + geometry_.height;
@@ -128,7 +182,7 @@
128 }182 }
129 else183 else
130 {184 {
131 if (geometry_.x < screenWidth / 2)185 if (geometry_.x - monitor.x_org < monitor.width / 2)
132 {186 {
133 /* left */187 /* left */
134 data[0] = geometry_.x + geometry_.width;188 data[0] = geometry_.x + geometry_.width;
135189
=== modified file 'NuxGraphics/XInputWindow.h'
--- NuxGraphics/XInputWindow.h 2011-09-20 06:03:43 +0000
+++ NuxGraphics/XInputWindow.h 2011-09-28 12:34:00 +0000
@@ -28,6 +28,7 @@
28#include <X11/Xatom.h>28#include <X11/Xatom.h>
29/* keysym.h contains keysymbols which we use to resolv what keys that are being pressed */29/* keysym.h contains keysymbols which we use to resolv what keys that are being pressed */
30#include <X11/keysym.h>30#include <X11/keysym.h>
31#include <X11/Xregion.h>
3132
32#include <X11/extensions/xf86vmode.h>33#include <X11/extensions/xf86vmode.h>
3334
3435
=== modified file 'NuxGraphics/nux-graphics.pc.in'
--- NuxGraphics/nux-graphics.pc.in 2011-09-20 06:03:43 +0000
+++ NuxGraphics/nux-graphics.pc.in 2011-09-28 12:34:00 +0000
@@ -8,4 +8,4 @@
8Version: @VERSION@8Version: @VERSION@
9Libs: -L${libdir} -lnux-graphics-@NUX_API_VERSION@9Libs: -L${libdir} -lnux-graphics-@NUX_API_VERSION@
10Cflags: -I${includedir}/Nux-@NUX_API_VERSION@10Cflags: -I${includedir}/Nux-@NUX_API_VERSION@
11Requires: glib-2.0 nux-core-@NUX_API_VERSION@ nux-image-@NUX_API_VERSION@ gl glu xxf86vm glew glewmx 11Requires: glib-2.0 nux-core-@NUX_API_VERSION@ nux-image-@NUX_API_VERSION@ gl glu xxf86vm glew glewmx xinerama
1212
=== modified file 'configure.ac'
--- configure.ac 2011-09-26 09:42:41 +0000
+++ configure.ac 2011-09-28 12:34:00 +0000
@@ -143,6 +143,7 @@
143 glewmx143 glewmx
144 xxf86vm144 xxf86vm
145 sigc++-2.0145 sigc++-2.0
146 xinerama
146 )147 )
147AC_SUBST(NUX_GRAPHICS_CFLAGS)148AC_SUBST(NUX_GRAPHICS_CFLAGS)
148AC_SUBST(NUX_GRAPHICS_LIBS)149AC_SUBST(NUX_GRAPHICS_LIBS)

Subscribers

People subscribed via source and target branches