From 4ab65eaadc701bd75bf2462b55c1a18ad155bd85 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Wed, 2 May 2012 06:16:09 +0000 Subject: [PATCH] Move window creation to a private theme method. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/branches/theme_window_override@35136 72102866-910b-0410-8b05-ffd578937521 --- Source/x11/XGServerWindow.m | 130 ++++++++++++++++++++---------------- 1 file changed, 74 insertions(+), 56 deletions(-) diff --git a/Source/x11/XGServerWindow.m b/Source/x11/XGServerWindow.m index 9328956..f9ab42e 100644 --- a/Source/x11/XGServerWindow.m +++ b/Source/x11/XGServerWindow.m @@ -43,6 +43,7 @@ #include #include #include +#include #ifdef HAVE_UNISTD_H #include @@ -94,6 +95,54 @@ static NSMapTable *windowtags = NULL; static int last_win_num = 0; +@interface GSTheme (Backend) +- (Window) createWindowWithDisplay: (Display *)disp + parent: (Window)parent + X: (int)x + Y: (int)y + width: (unsigned int)width + height: (unsigned int)height + borderWidth: (unsigned int)borderWidth + depth: (int)depth + class: (unsigned int)cls + visual: (Visual *)visual + valuemask: (unsigned long)valuemask + attributes: (XSetWindowAttributes *)attrs; +@end + +@implementation GSTheme (Backend) +// Create Window method... +- (Window) createWindowWithDisplay: (Display *)disp + parent: (Window)parent + X: (int)x + Y: (int)y + width: (unsigned int)width + height: (unsigned int)height + borderWidth: (unsigned int)borderWidth + depth: (int)depth + class: (unsigned int)cls + visual: (Visual *)visual + valuemask: (unsigned long)valuemask + attributes: (XSetWindowAttributes *)attrs +{ + Window ident; + ident = XCreateWindow(disp, + parent, + x, + y, + width, + height, + borderWidth, + depth, + cls, + visual, + valuemask, + attrs); + return ident; +} +// End create window method... +@end + @interface NSCursor (BackendPrivate) - (void *)_cid; @end @@ -791,19 +840,19 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg) window->xwn_attrs.save_under = False; window->xwn_attrs.override_redirect = False; - window->ident = [self createWindowWithDisplay: dpy - parent: window->root - X: NSMinX(frame) - Y: NSMinY(frame) - width: NSWidth(frame) - height: NSHeight(frame) - borderWidth: 0 - depth: context->depth - class: CopyFromParent - visual: context->visual - valuemask: (CWColormap | CWBackPixel | CWBorderPixel | CWOverrideRedirect) - attributes: &window->xwn_attrs]; - + window->ident = [[GSTheme theme] createWindowWithDisplay: dpy + parent: window->root + X: NSMinX(frame) + Y: NSMinY(frame) + width: NSWidth(frame) + height: NSHeight(frame) + borderWidth: 0 + depth: context->depth + class: CopyFromParent + visual: context->visual + valuemask: (CWColormap | CWBackPixel | CWBorderPixel | CWOverrideRedirect) + attributes: &window->xwn_attrs]; + /* window->ident = XCreateWindow(dpy, window->root, NSMinX(frame), NSMinY(frame), @@ -1965,37 +2014,6 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg) } } -// Create Window method... -- (Window) createWindowWithDisplay: (Display *)disp - parent: (Window)parent - X: (int)x - Y: (int)y - width: (unsigned int)width - height: (unsigned int)height - borderWidth: (unsigned int)borderWidth - depth: (int)depth - class: (unsigned int)cls - visual: (Visual *)visual - valuemask: (unsigned long)valuemask - attributes: (XSetWindowAttributes *)attrs -{ - Window ident; - ident = XCreateWindow(disp, - parent, - x, - y, - width, - height, - borderWidth, - depth, - cls, - visual, - valuemask, - attrs); - return ident; -} -// End create window method... - - (int) window: (NSRect)frame : (NSBackingStoreType)type : (unsigned int)style : (int)screen { @@ -2052,18 +2070,18 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg) */ window->xwn_attrs.override_redirect = False; - window->ident = [self createWindowWithDisplay: dpy - parent: window->root - X: NSMinX(frame) - Y: NSMinY(frame) - width: NSWidth(frame) - height: NSHeight(frame) - borderWidth: 0 - depth: context->depth - class: CopyFromParent - visual: context->visual - valuemask: (CWColormap | CWBackPixel | CWBorderPixel | CWOverrideRedirect) - attributes: &window->xwn_attrs]; + window->ident = [[GSTheme theme] createWindowWithDisplay: dpy + parent: window->root + X: NSMinX(frame) + Y: NSMinY(frame) + width: NSWidth(frame) + height: NSHeight(frame) + borderWidth: 0 + depth: context->depth + class: CopyFromParent + visual: context->visual + valuemask: (CWColormap | CWBackPixel | CWBorderPixel | CWOverrideRedirect) + attributes: &window->xwn_attrs]; /*