From f99e97c43ed9d7f9c32017671b2e636d27e0425c Mon Sep 17 00:00:00 2001 From: Fred Kiefer Date: Thu, 29 Jan 2009 09:32:32 +0000 Subject: [PATCH] Implement new method -setPartentWindow:forChildWindow: for X and Windows. Adjust y coordinate of point in compositeGState:... for cairo. This solves bug #24709. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@27718 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 12 ++++++++++-- Source/cairo/CairoGState.m | 2 +- Source/win32/WIN32Server.m | 5 +++++ Source/x11/XGServerWindow.m | 39 +++++++++++++++++++++++++++++++------ 4 files changed, 49 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 44aba73..5a6e45f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,11 +1,19 @@ +2009-01-29 Fred Kiefer + + * Source/win32/WIN32Server.m (-setPartentWindow:forChildWindow:), + * Source/x11/XGServerWindow.m (-setPartentWindow:forChildWindow:): + Implement new method. + * Source/cairo/CairoGState.m (-compositeGState:...): Adjust y + coordinate of point. + 2009-01-25 Riccardo Mottola * Source/art/image.m: Fix for big-endiam machines - 2009-01-24 Riccardo Mottola - * Source/art/image.m: Optimized and correct handling of 16 bit in _get_8_bits() + * Source/art/image.m: Optimized and correct handling of 16 bit in + _get_8_bits() 2009-01-17 Wolfgang Lux diff --git a/Source/cairo/CairoGState.m b/Source/cairo/CairoGState.m index f49c409..a494279 100644 --- a/Source/cairo/CairoGState.m +++ b/Source/cairo/CairoGState.m @@ -1277,7 +1277,7 @@ _set_op(cairo_t *ct, NSCompositingOperation op) [source->ctm boundingRectFor: aRect result: &aRect]; x = floorf(aPoint.x); - y = floorf(aPoint.y); + y = floorf(aPoint.y + 0.5); minx = NSMinX(aRect); miny = NSMinY(aRect); width = NSWidth(aRect); diff --git a/Source/win32/WIN32Server.m b/Source/win32/WIN32Server.m index d8c0076..13bbfc4 100644 --- a/Source/win32/WIN32Server.m +++ b/Source/win32/WIN32Server.m @@ -1563,6 +1563,11 @@ NSLog(@"Callback"); SetCursor((HCURSOR)cid); } +- (void) setPartentWindow: (int)partentWin + forChildWindow: (int)childWin +{ + SetParent((HWND)childWin, (HWND)partentWin); +} @end diff --git a/Source/x11/XGServerWindow.m b/Source/x11/XGServerWindow.m index 6b0dd8f..0365cf1 100644 --- a/Source/x11/XGServerWindow.m +++ b/Source/x11/XGServerWindow.m @@ -727,6 +727,8 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg) window->xwn_attrs.border_pixel = context->black; window->xwn_attrs.background_pixel = context->white; window->xwn_attrs.colormap = context->cmap; + window->xwn_attrs.save_under = False; + window->xwn_attrs.override_redirect = False; window->ident = XCreateWindow(dpy, window->root, NSMinX(frame), NSMinY(frame), @@ -735,7 +737,7 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg) context->depth, CopyFromParent, context->visual, - (CWColormap | CWBackPixel | CWBorderPixel), + (CWColormap | CWBackPixel | CWBorderPixel | CWOverrideRedirect), &window->xwn_attrs); /* @@ -745,8 +747,6 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg) classhint.res_class = "GNUstep"; XSetClassHint(dpy, window->ident, &classhint); - window->xwn_attrs.save_under = False; - window->xwn_attrs.override_redirect = False; window->map_state = IsUnmapped; window->visibility = 2; @@ -1207,8 +1207,10 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg) generic.wintypes.win_dnd_atom = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DND", False); //KDE extensions +#ifdef USE_KDE_OVERRIDE generic.wintypes.win_override_atom = XInternAtom(dpy, "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE", False); +#endif generic.wintypes.win_topmenu_atom = XInternAtom(dpy, "_KDE_NET_WM_WINDOW_TYPE_TOPMENU", False); @@ -1909,6 +1911,13 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg) window->xwn_attrs.border_pixel = context->black; window->xwn_attrs.background_pixel = context->white; window->xwn_attrs.colormap = context->cmap; + window->xwn_attrs.save_under = False; + /* + * Setting this to True should only be done, when we also grap the pointer. + * It could be done for popup windows, but at this point we don't know + * about the usage of the window. + */ + window->xwn_attrs.override_redirect = False; window->ident = XCreateWindow(dpy, window->root, NSMinX(frame), NSMinY(frame), @@ -1917,7 +1926,7 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg) context->depth, CopyFromParent, context->visual, - (CWColormap | CWBackPixel | CWBorderPixel), + (CWColormap | CWBackPixel | CWBorderPixel | CWOverrideRedirect), &window->xwn_attrs); /* @@ -1927,8 +1936,6 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg) classhint.res_class = "GNUstep"; XSetClassHint(dpy, window->ident, &classhint); - window->xwn_attrs.save_under = False; - window->xwn_attrs.override_redirect = False; window->map_state = IsUnmapped; window->visibility = -1; @@ -4615,4 +4622,24 @@ _computeDepth(int class, int bpp) return NO; } +- (void) setPartentWindow: (int)partentWin + forChildWindow: (int)childWin +{ + gswindow_device_t *cwindow; + gswindow_device_t *pwindow; + Window p; + + cwindow = WINDOW_WITH_TAG(childWin); + if (!cwindow) + return; + + pwindow = WINDOW_WITH_TAG(partentWin); + if (!pwindow) + p = None; + else + p = pwindow->ident; + + XSetTransientForHint(dpy, cwindow->ident, p); +} + @end