New method -_XFrameToXHints:for:.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@22923 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2006-05-13 20:56:18 +00:00
parent c7e1737369
commit f4868d3a43
4 changed files with 52 additions and 21 deletions

View file

@ -1,3 +1,12 @@
2006-05-13 Fred Kiefer <FredKiefer@gmx.de>
* Headers/x11/XGServer.h,
* Source/x11/XGServerWindow.m (-_XFrameToXHints:for:): New method to
compute X hints directly from X frame. Previously the X frame
was converted to an OS frame and from this the X hints were computed.
* Source/x11/XGServerWindow.m, Source/x11/XGServerEvent.m:
Replaced all usages of _OSFrameToXHints:for: with _XFrameToXHints:for:.
2006-05-04 Fred Kiefer <FredKiefer@gmx.de>
* Source/x11/XGServerWindow.m (-styleoffsets::::::): New method to

View file

@ -80,6 +80,7 @@ typedef enum {
- (NSRect) _OSFrameToXFrame: (NSRect)o for: (void*)window;
- (NSRect) _OSFrameToXHints: (NSRect)o for: (void*)window;
- (NSRect) _XFrameToOSFrame: (NSRect)x for: (void*)window;
- (NSRect) _XFrameToXHints: (NSRect)o for: (void*)window;
@end
// Public interface for the input methods.

View file

@ -770,7 +770,7 @@ static int check_modifier (XEvent *xEvent, KeySym key_sym,
/*
* Set size hints info to be up to date with new size.
*/
h = [self _OSFrameToXHints: n for: cWin];
h = [self _XFrameToXHints: x for: cWin];
cWin->siz_hints.width = h.size.width;
cWin->siz_hints.height = h.size.height;

View file

@ -450,7 +450,7 @@ NSDebugLLog(@"Frame", @"O2X %d, %@, %@", win->number,
o.origin.x = x.origin.x;
o.origin.y = win->siz_hints.height - x.origin.y;
o.origin.y = o.origin.y - o.size.height;
NSDebugLLog(@"GGFrame", @"%@ %@", NSStringFromRect(x), NSStringFromRect(o));
NSDebugLLog(@"Frame", @"X2O %@ %@", NSStringFromRect(x), NSStringFromRect(o));
return o;
}
@ -472,6 +472,28 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
return o;
}
/*
* Convert a window frame in X absolute screen coordinates to
* a frame suitable for setting X hints for a window manager.
*/
- (NSRect) _XFrameToXHints: (NSRect)o for: (void*)window
{
gswindow_device_t *win = (gswindow_device_t*)window;
NSRect x;
float t, b, l, r;
[self styleoffsets: &l : &r : &t : &b : win->win_attrs.window_style : win->ident];
// FIXME: When adding the frame here, we get X window errors!
x.size.width = o.size.width; // + l + r;
x.size.height = o.size.height; // + t + b;
x.origin.x = o.origin.x - l;
x.origin.y = o.origin.y - t;
NSDebugLLog(@"Frame", @"X2H %d, %@, %@", win->number,
NSStringFromRect(o), NSStringFromRect(x));
return x;
}
- (XGWMProtocols) _checkWindowManager
{
@ -1200,8 +1222,7 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
* Prepare size/position hints, but don't set them now - ordering
* the window in should automatically do it.
*/
frame = [self _XFrameToOSFrame: window->xframe for: window];
frame = [self _OSFrameToXHints: frame for: window];
frame = [self _XFrameToXHints: window->xframe for: window];
window->siz_hints.x = NSMinX(frame);
window->siz_hints.y = NSMinY(frame);
window->siz_hints.width = NSWidth(frame);
@ -1368,8 +1389,7 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
* Prepare size/position hints, but don't set them now - ordering
* the window in should automatically do it.
*/
xframe = [self _XFrameToOSFrame: window->xframe for: window];
xframe = [self _OSFrameToXHints: xframe for: window];
xframe = [self _XFrameToXHints: window->xframe for: window];
window->siz_hints.x = NSMinX(xframe);
window->siz_hints.y = NSMinY(xframe);
window->siz_hints.width = NSWidth(xframe);
@ -1482,7 +1502,8 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
extents = (unsigned long *)PropGetCheckProperty(dpy, win, _net_frame_extents,
XA_CARDINAL, 32, 4, &count);
if (!extents && (generic.wm & XGWM_KDE))
if (!extents) // && (generic.wm & XGWM_KDE))
{
if (_kde_frame_strut == None)
{
@ -1607,8 +1628,7 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
window->win_attrs.window_style = style;
/* Fix up hints */
h = [self _XFrameToOSFrame: window->xframe for: window];
h = [self _OSFrameToXHints: h for: window];
h = [self _XFrameToXHints: window->xframe for: window];
window->siz_hints.x = NSMinX(h);
window->siz_hints.y = NSMinY(h);
window->siz_hints.width = NSWidth(h);
@ -2203,9 +2223,10 @@ static BOOL didCreatePixmaps;
{
NSEvent *e;
NSRect xVal;
NSRect xHint;
NSRect frame;
gswindow_device_t *window;
NSWindow *nswin;
NSRect frame;
BOOL resize = NO;
BOOL move = NO;
@ -2232,12 +2253,12 @@ static BOOL didCreatePixmaps;
move = YES;
}
xVal = [self _OSFrameToXHints: rect for: window];
window->siz_hints.width = (int)xVal.size.width;
window->siz_hints.height = (int)xVal.size.height;
window->siz_hints.x = (int)xVal.origin.x;
window->siz_hints.y = (int)xVal.origin.y;
xVal = [self _OSFrameToXFrame: rect for: window];
xHint = [self _XFrameToXHints: xVal for: window];
window->siz_hints.width = (int)xHint.size.width;
window->siz_hints.height = (int)xHint.size.height;
window->siz_hints.x = (int)xHint.origin.x;
window->siz_hints.y = (int)xHint.origin.y;
NSDebugLLog(@"Moving", @"Place %d - o:%@, x:%@", window->number,
NSStringFromRect(rect), NSStringFromRect(xVal));