Changeset 103929 in webkit
- Timestamp:
- Jan 3, 2012 1:17:04 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r103923 r103929 1 2012-01-03 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Use gdk_screen_get_monitor_workarea() when available for screenAvailableRect() 4 https://bugs.webkit.org/show_bug.cgi?id=75435 5 6 Reviewed by Martin Robinson. 7 8 * platform/gtk/GtkVersioning.c: 9 (getScreenCurrentDesktop): 10 (getScreenWorkArea): 11 (gdk_screen_get_monitor_workarea): Implement it when GTK+ < 3.3.6. 12 * platform/gtk/GtkVersioning.h: 13 * platform/gtk/PlatformScreenGtk.cpp: 14 (WebCore::screenAvailableRect): Use 15 gdk_screen_get_monitor_workarea() instead of our own 16 implementation. 17 1 18 2012-01-02 Kentaro Hara <haraken@chromium.org> 2 19 -
trunk/Source/WebCore/platform/gtk/GtkVersioning.c
r93854 r103929 22 22 23 23 #include <gtk/gtk.h> 24 25 #ifdef GDK_WINDOWING_X11 26 #include <X11/Xatom.h> 27 #include <gdk/gdkx.h> 28 #endif 24 29 25 30 #if !GTK_CHECK_VERSION(2, 14, 0) … … 304 309 #endif // GTK_CHECK_VERSION(2, 22, 0) 305 310 311 #if !GTK_CHECK_VERSION(3, 3, 6) 312 #ifdef GDK_WINDOWING_X11 313 static int getScreenCurrentDesktop(GdkScreen *screen) 314 { 315 Display *display = GDK_DISPLAY_XDISPLAY(gdk_screen_get_display(screen)); 316 Window rootWindow = XRootWindow(display, GDK_SCREEN_XNUMBER(screen)); 317 Atom currentDesktop = XInternAtom(display, "_NET_CURRENT_DESKTOP", True); 318 319 Atom type; 320 int format; 321 unsigned long itemsCount, bytesAfter; 322 unsigned char *returnedData = NULL; 323 XGetWindowProperty(display, rootWindow, currentDesktop, 0, G_MAXLONG, False, XA_CARDINAL, 324 &type, &format, &itemsCount, &bytesAfter, &returnedData); 325 326 int workspace = 0; 327 if (type == XA_CARDINAL && format == 32 && itemsCount > 0) 328 workspace = (int)returnedData[0]; 329 330 if (returnedData) 331 XFree(returnedData); 332 333 return workspace; 334 } 335 336 static void getScreenWorkArea(GdkScreen *screen, GdkRectangle *area) 337 { 338 Display *display = GDK_DISPLAY_XDISPLAY(gdk_screen_get_display(screen)); 339 Atom workArea = XInternAtom(display, "_NET_WORKAREA", True); 340 341 /* Defaults in case of error. */ 342 area->x = 0; 343 area->y = 0; 344 area->width = gdk_screen_get_width(screen); 345 area->height = gdk_screen_get_height(screen); 346 347 if (workArea == None) 348 return; 349 350 Window rootWindow = XRootWindow(display, GDK_SCREEN_XNUMBER(screen)); 351 Atom type; 352 int format; 353 unsigned long itemsCount, bytesAfter; 354 unsigned char *returnedData = 0; 355 int result = XGetWindowProperty(display, rootWindow, workArea, 0, 4 * 32 /* Max length */, False, AnyPropertyType, 356 &type, &format, &itemsCount, &bytesAfter, &returnedData); 357 if (result != Success || type == None || !format || bytesAfter || itemsCount % 4) 358 return; 359 360 int desktop = getScreenCurrentDesktop(screen); 361 long *workAreas = (long *)returnedData; 362 area->x = workAreas[desktop * 4]; 363 area->y = workAreas[desktop * 4 + 1]; 364 area->width = workAreas[desktop * 4 + 2]; 365 area->height = workAreas[desktop * 4 + 3]; 366 367 XFree(returnedData); 368 } 369 #endif // GDK_WINDOWING_X11 370 371 void gdk_screen_get_monitor_workarea(GdkScreen *screen, int monitor, GdkRectangle *area) 372 { 373 gdk_screen_get_monitor_geometry(screen, monitor, area); 374 375 #ifdef GDK_WINDOWING_X11 376 GdkRectangle workArea; 377 getScreenWorkArea(screen, &workArea); 378 gdk_rectangle_intersect(&workArea, area, area); 379 #endif 380 } 381 #endif // GTK_CHECK_VERSION(3, 3, 6) -
trunk/Source/WebCore/platform/gtk/GtkVersioning.h
r95901 r103929 118 118 #endif 119 119 120 #if !GTK_CHECK_VERSION(3, 3, 6) 121 void gdk_screen_get_monitor_workarea(GdkScreen *, int monitor, GdkRectangle *area); 122 #endif 123 120 124 G_END_DECLS 121 125 -
trunk/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp
r102802 r103929 39 39 40 40 #include <gtk/gtk.h> 41 42 #if PLATFORM(X11)43 #include <gdk/gdkx.h>44 #include <X11/Xatom.h>45 #endif46 41 47 42 namespace WebCore { … … 135 130 return FloatRect(); 136 131 137 #if PLATFORM(X11)138 132 GtkWidget* container = GTK_WIDGET(widget->root()->hostWindow()->platformPageClient()); 139 133 if (container && !gtk_widget_get_realized(container)) … … 144 138 return FloatRect(); 145 139 146 GdkWindow* rootWindow = gdk_screen_get_root_window(screen); 147 GdkDisplay* display = gdk_window_get_display(rootWindow); 148 Atom xproperty = gdk_x11_get_xatom_by_name_for_display(display, "_NET_WORKAREA"); 140 gint monitor = container ? gdk_screen_get_monitor_at_window(screen, gtk_widget_get_window(container)) : 0; 149 141 150 Atom retType; 151 int retFormat; 152 long *workAreaPos = NULL; 153 unsigned long retNItems; 154 unsigned long retAfter; 155 int xRes = XGetWindowProperty(GDK_DISPLAY_XDISPLAY(display), GDK_WINDOW_XWINDOW(rootWindow), xproperty, 156 0, 4, FALSE, XA_CARDINAL, &retType, &retFormat, &retNItems, &retAfter, (guchar**)&workAreaPos); 142 GdkRectangle workArea; 143 gdk_screen_get_monitor_workarea(screen, monitor, &workArea); 157 144 158 FloatRect rect; 159 if (xRes == Success && workAreaPos != NULL && retType == XA_CARDINAL && retNItems == 4 && retFormat == 32) { 160 rect = FloatRect(workAreaPos[0], workAreaPos[1], workAreaPos[2], workAreaPos[3]); 161 // rect contains the available space in the whole screen not just in the monitor 162 // containing the widget, so we intersect it with the monitor rectangle. 163 rect.intersect(screenRect(widget)); 164 } else 165 rect = screenRect(widget); 145 return FloatRect(workArea.x, workArea.y, workArea.width, workArea.height); 166 146 167 if (workAreaPos)168 XFree(workAreaPos);169 170 return rect;171 #else172 return screenRect(widget);173 #endif174 147 } 175 148 -
trunk/Source/WebKit/gtk/ChangeLog
r103321 r103929 1 2012-01-03 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Use gdk_screen_get_monitor_workarea() when available for screenAvailableRect() 4 https://bugs.webkit.org/show_bug.cgi?id=75435 5 6 Reviewed by Martin Robinson. 7 8 * GNUmakefile.am: Make sure unit tests link to X11. 9 1 10 2011-12-20 Yuta Kitamura <yutak@chromium.org> 2 11 -
trunk/Source/WebKit/gtk/GNUmakefile.am
r102448 r103929 421 421 $(GLIB_CFLAGS) \ 422 422 $(GTK_CFLAGS) \ 423 $(LIBSOUP_CFLAGS) 423 $(LIBSOUP_CFLAGS) \ 424 $(XRENDER_LIBS) \ 425 $(XT_LIBS) 424 426 425 427 webkit_tests_ldadd = \ -
trunk/Tools/ChangeLog
r103928 r103929 1 2012-01-03 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Use gdk_screen_get_monitor_workarea() when available for screenAvailableRect() 4 https://bugs.webkit.org/show_bug.cgi?id=75435 5 6 Reviewed by Martin Robinson. 7 8 * GNUmakefile.am: Make sure DRT links to X11. 9 * WebKitTestRunner/GNUmakefile.am: Make sure WTR links to X11. 10 1 11 2011-12-04 Philippe Normand <pnormand@igalia.com> 2 12 -
trunk/Tools/GNUmakefile.am
r103038 r103929 159 159 $(LIBSOUP_LIBS) \ 160 160 $(FREETYPE_LIBS) \ 161 $(WINMM_LIBS) 161 $(WINMM_LIBS) \ 162 $(XRENDER_LIBS) \ 163 $(XT_LIBS) 162 164 163 165 Programs_DumpRenderTree_LDFLAGS = \ -
trunk/Tools/WebKitTestRunner/GNUmakefile.am
r101710 r103929 52 52 $(LIBSOUP_LIBS) \ 53 53 $(FREETYPE_LIBS) \ 54 $(WINMM_LIBS) 54 $(WINMM_LIBS) \ 55 $(XRENDER_LIBS) \ 56 $(XT_LIBS) 55 57 56 58 Programs_WebKitTestRunner_LDFLAGS = \
Note: See TracChangeset
for help on using the changeset viewer.