mirror of
https://github.com/gnustep/libs-back.git
synced 2025-04-22 23:42:16 +00:00
Additional updates for windows backend
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/branches/gnustep_testplant_branch@35707 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
30941f5681
commit
aa519f55a8
5 changed files with 214 additions and 281 deletions
|
@ -136,6 +136,7 @@ typedef struct w32serverFlags {
|
|||
- (void) decodeWM_WINDOWPOSCHANGINGParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
||||
- (void) decodeWM_WINDOWPOSCHANGEDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
||||
- (LRESULT) decodeWM_GETMINMAXINFOParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
||||
- (LRESULT) decodeWM_ENTERSIZEMOVEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
||||
- (LRESULT) decodeWM_EXITSIZEMOVEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
|
||||
- (LRESULT) decodeWM_MOVINGParams: (HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam;
|
||||
- (LRESULT) decodeWM_SIZINGParams: (HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam;
|
||||
|
|
|
@ -52,8 +52,8 @@ static void CairoSurfaceDestroyCallback(void *surfacePtr)
|
|||
HWND whandle = (HWND)cairo_surface_get_user_data(surface, &SurfaceHWND);
|
||||
if (whandle == NULL)
|
||||
{
|
||||
NSLog(@"%s:Window handle is NULL - leaking DC: %p\n", __PRETTY_FUNCTION__,
|
||||
cairo_win32_surface_get_dc(surface));
|
||||
NSWarnMLog(@"Window handle is NULL - leaking DC: %p\n",
|
||||
cairo_win32_surface_get_dc(surface));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -81,7 +81,7 @@ static void CairoSurfaceDestroyCallback(void *surfacePtr)
|
|||
|
||||
if (!hDC)
|
||||
{
|
||||
NSLog(@"%s:Win32CairoSurface line: %d : no device context", __PRETTY_FUNCTION__, __LINE__);
|
||||
NSWarnMLog(@"Win32CairoSurface line: %d : no device context", __LINE__);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -93,15 +93,14 @@ static void CairoSurfaceDestroyCallback(void *surfacePtr)
|
|||
{
|
||||
// This is the raw DC surface...
|
||||
_surface = cairo_win32_surface_create(hDC);
|
||||
NSLog(@"%s:NSBackingStoreNonretained", __PRETTY_FUNCTION__);
|
||||
NSWarnMLog(@"NSBackingStoreNonretained\n");
|
||||
|
||||
// Check for error...
|
||||
if (cairo_surface_status(_surface) != CAIRO_STATUS_SUCCESS)
|
||||
{
|
||||
// Output the surface create error...
|
||||
cairo_status_t status = cairo_surface_status(_surface);
|
||||
NSLog(@"%s:surface create FAILED - status: %s\n", __PRETTY_FUNCTION__,
|
||||
cairo_status_to_string(status));
|
||||
NSWarnMLog(@"surface create FAILED - status: %s\n", cairo_status_to_string(status));
|
||||
|
||||
// And deallocate ourselves...
|
||||
DESTROY(self);
|
||||
|
@ -109,10 +108,7 @@ static void CairoSurfaceDestroyCallback(void *surfacePtr)
|
|||
}
|
||||
else
|
||||
{
|
||||
RECT crect;
|
||||
|
||||
// Get the client rectangle information...
|
||||
GetClientRect(GSWINDEVICE, &crect);
|
||||
NSSize csize = [self size];
|
||||
|
||||
// This is the raw DC surface...
|
||||
cairo_surface_t *window = cairo_win32_surface_create(hDC);
|
||||
|
@ -122,8 +118,7 @@ static void CairoSurfaceDestroyCallback(void *surfacePtr)
|
|||
{
|
||||
// Output the surface create error...
|
||||
cairo_status_t status = cairo_surface_status(window);
|
||||
NSLog(@"%s:surface create FAILED - status: %s\n", __PRETTY_FUNCTION__,
|
||||
cairo_status_to_string(status));
|
||||
NSWarnMLog(@"surface create FAILED - status: %s\n", cairo_status_to_string(status));
|
||||
|
||||
// Destroy the initial surface created...
|
||||
cairo_surface_destroy(window);
|
||||
|
@ -140,16 +135,15 @@ static void CairoSurfaceDestroyCallback(void *surfacePtr)
|
|||
// it incorrectly thinks the clear failed...so we will init with
|
||||
// a minimum size of 1 for width/height...
|
||||
_surface = cairo_surface_create_similar(window, CAIRO_CONTENT_COLOR_ALPHA,
|
||||
MAX(1, crect.right - crect.left),
|
||||
MAX(1, crect.bottom - crect.top));
|
||||
MAX(1, csize.width),
|
||||
MAX(1, csize.height));
|
||||
|
||||
// Check for error...
|
||||
if (cairo_surface_status(_surface) != CAIRO_STATUS_SUCCESS)
|
||||
{
|
||||
// Output the surface create error...
|
||||
cairo_status_t status = cairo_surface_status(_surface);
|
||||
NSLog(@"%s:surface create FAILED - status: %s\n", __PRETTY_FUNCTION__,
|
||||
cairo_status_to_string(status));
|
||||
NSWarnMLog(@"surface create FAILED - status: %s\n", cairo_status_to_string(status));
|
||||
|
||||
// Destroy the initial surface created...
|
||||
cairo_surface_destroy(window);
|
||||
|
@ -187,16 +181,15 @@ static void CairoSurfaceDestroyCallback(void *surfacePtr)
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
//NSLog(@"%s:self: %@\n", __PRETTY_FUNCTION__, self);
|
||||
if ((_surface == NULL) || (cairo_surface_status(_surface) != CAIRO_STATUS_SUCCESS))
|
||||
{
|
||||
NSLog(@"%s:null surface or bad status\n", __PRETTY_FUNCTION__);
|
||||
NSWarnMLog(@"null surface or bad status\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cairo_win32_surface_get_dc(_surface) == NULL)
|
||||
{
|
||||
NSLog(@"%s:HDC is NULL for surface: %@\n", __PRETTY_FUNCTION__, self);
|
||||
NSWarnMLog(@"HDC is NULL for surface: %@\n", self);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -208,48 +201,42 @@ static void CairoSurfaceDestroyCallback(void *surfacePtr)
|
|||
|
||||
- (NSString*) description
|
||||
{
|
||||
HDC hdc = NULL;
|
||||
HDC shdc = NULL;
|
||||
HDC whdc = NULL;
|
||||
cairo_surface_t *window = NULL;
|
||||
if (_surface)
|
||||
hdc = cairo_win32_surface_get_dc(_surface);
|
||||
NSMutableString *description = [[[super description] mutableCopy] autorelease];
|
||||
{
|
||||
shdc = cairo_win32_surface_get_dc(_surface);
|
||||
window = cairo_surface_get_user_data(_surface, &SurfaceWindow);
|
||||
if (window)
|
||||
whdc = cairo_win32_surface_get_dc(window);
|
||||
}
|
||||
NSMutableString *description = AUTORELEASE([[super description] mutableCopy]);
|
||||
[description appendFormat: @" size: %@",NSStringFromSize([self size])];
|
||||
[description appendFormat: @" _surface: %p",_surface];
|
||||
[description appendFormat: @" dc: %p",hdc];
|
||||
return [[description copy] autorelease];
|
||||
[description appendFormat: @" surfDC: %p",shdc];
|
||||
[description appendFormat: @" window: %p",window];
|
||||
[description appendFormat: @" windDC: %p",whdc];
|
||||
return AUTORELEASE([description copy]);
|
||||
}
|
||||
|
||||
- (NSSize) size
|
||||
{
|
||||
RECT sz;
|
||||
RECT csize;
|
||||
|
||||
GetClientRect(GSWINDEVICE, &sz);
|
||||
return NSMakeSize(sz.right - sz.left, sz.top - sz.bottom);
|
||||
GetClientRect(GSWINDEVICE, &csize);
|
||||
return NSMakeSize(csize.right - csize.left, csize.bottom - csize.top);
|
||||
}
|
||||
|
||||
- (void) setSize: (NSSize)newSize
|
||||
{
|
||||
NSDebugLLog(@"Win32CairoSurface",
|
||||
@"%s:size: %@\n", __PRETTY_FUNCTION__,
|
||||
NSStringFromSize(newSize));
|
||||
NSDebugMLLog(@"Win32CairoSurface", @"size: %@\n", NSStringFromSize(newSize));
|
||||
}
|
||||
|
||||
- (void) handleExposeRect: (NSRect)rect
|
||||
{
|
||||
NSDebugLLog(@"Win32CairoSurface",
|
||||
@"%s:rect: %@\n", __PRETTY_FUNCTION__,
|
||||
NSStringFromRect(rect));
|
||||
|
||||
// If the surface is buffered then it will have the main surface set as user data...
|
||||
cairo_surface_t *window = cairo_surface_get_user_data(_surface, &SurfaceWindow);
|
||||
|
||||
#if 0
|
||||
NSWindow *nswindow = GSWindowWithNumber(gsDevice);
|
||||
if ([[nswindow title] isEqualToString: @"GSToolTips"])
|
||||
{
|
||||
NSLog(@"%s:title: %@ _surface: %p window: %p rect: %@\n", __PRETTY_FUNCTION__,
|
||||
[nswindow title], _surface, window,
|
||||
NSStringFromRect(rect));
|
||||
}
|
||||
#endif
|
||||
|
||||
// If the surface is buffered then...
|
||||
if (window)
|
||||
|
@ -257,8 +244,8 @@ static void CairoSurfaceDestroyCallback(void *surfacePtr)
|
|||
// First check the current status of the foreground surface...
|
||||
if (cairo_surface_status(window) != CAIRO_STATUS_SUCCESS)
|
||||
{
|
||||
NSLog(@"%s:cairo initial window error status: %s\n", __PRETTY_FUNCTION__,
|
||||
cairo_status_to_string(cairo_surface_status(window)));
|
||||
NSWarnMLog(@"cairo initial window error status: %s\n",
|
||||
cairo_status_to_string(cairo_surface_status(window)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -266,11 +253,10 @@ static void CairoSurfaceDestroyCallback(void *surfacePtr)
|
|||
|
||||
if (cairo_status(context) != CAIRO_STATUS_SUCCESS)
|
||||
{
|
||||
NSLog(@"%s:cairo context create error - status: _surface: %s window: %s windowCtxt: %s (%d)",
|
||||
__PRETTY_FUNCTION__,
|
||||
cairo_status_to_string(cairo_surface_status(_surface)),
|
||||
cairo_status_to_string(cairo_surface_status(window)),
|
||||
cairo_status_to_string(cairo_status(context)), cairo_get_reference_count(context));
|
||||
NSWarnMLog(@"cairo context create error - status: _surface: %s window: %s windowCtxt: %s (%d)",
|
||||
cairo_status_to_string(cairo_surface_status(_surface)),
|
||||
cairo_status_to_string(cairo_surface_status(window)),
|
||||
cairo_status_to_string(cairo_status(context)), cairo_get_reference_count(context));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -293,11 +279,10 @@ static void CairoSurfaceDestroyCallback(void *surfacePtr)
|
|||
|
||||
if (cairo_status(context) != CAIRO_STATUS_SUCCESS)
|
||||
{
|
||||
NSLog(@"%s:cairo expose error - status: _surface: %s window: %s windowCtxt: %s",
|
||||
__PRETTY_FUNCTION__,
|
||||
cairo_status_to_string(cairo_surface_status(_surface)),
|
||||
cairo_status_to_string(cairo_surface_status(window)),
|
||||
cairo_status_to_string(cairo_status(context)));
|
||||
NSWarnMLog(@"cairo expose error - status: _surface: %s window: %s windowCtxt: %s",
|
||||
cairo_status_to_string(cairo_surface_status(_surface)),
|
||||
cairo_status_to_string(cairo_surface_status(window)),
|
||||
cairo_status_to_string(cairo_status(context)));
|
||||
}
|
||||
|
||||
// Cleanup...
|
||||
|
|
|
@ -62,8 +62,6 @@
|
|||
|
||||
#include <math.h>
|
||||
|
||||
//#define USE_WS_POPUP
|
||||
|
||||
@interface W32DisplayMonitorInfo : NSObject
|
||||
{
|
||||
HMONITOR _hMonitor;
|
||||
|
@ -551,15 +549,7 @@ BOOL CALLBACK LoadDisplayMonitorInfo(HMONITOR hMonitor,
|
|||
|
||||
if (style == 0)
|
||||
{
|
||||
#if (BUILD_GRAPHICS==GRAPHICS_cairo)
|
||||
#if defined(USE_WS_POPUP)
|
||||
wstyle = WS_POPUP;
|
||||
#else
|
||||
wstyle = WS_OVERLAPPED;
|
||||
#endif
|
||||
#else
|
||||
wstyle = WS_POPUP;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -580,7 +570,7 @@ BOOL CALLBACK LoadDisplayMonitorInfo(HMONITOR hMonitor,
|
|||
wstyle |= WS_ICONIC;
|
||||
|
||||
if (wstyle == 0)
|
||||
wstyle = WS_POPUP; //WS_CAPTION+WS_SYSMENU;
|
||||
wstyle = WS_POPUP;
|
||||
}
|
||||
|
||||
//NSLog(@"Window wstyle %d for style %d", wstyle, style);
|
||||
|
@ -689,7 +679,6 @@ BOOL CALLBACK LoadDisplayMonitorInfo(HMONITOR hMonitor,
|
|||
|
||||
[self setFlagsforEventLoop: hwnd];
|
||||
|
||||
//NSLog(@"%s:event 0x%x", __PRETTY_FUNCTION__, uMsg);
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_SIZING:
|
||||
|
@ -743,10 +732,10 @@ BOOL CALLBACK LoadDisplayMonitorInfo(HMONITOR hMonitor,
|
|||
return [self decodeWM_SIZEParams: hwnd : wParam : lParam];
|
||||
break;
|
||||
case WM_ENTERSIZEMOVE:
|
||||
return [self decodeWM_ENTERSIZEMOVEParams: wParam : lParam : hwnd];
|
||||
break;
|
||||
case WM_EXITSIZEMOVE:
|
||||
//return [self decodeWM_EXITSIZEMOVEParams: wParam : lParam : hwnd];
|
||||
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
||||
return [self decodeWM_EXITSIZEMOVEParams: wParam : lParam : hwnd];
|
||||
break;
|
||||
case WM_ACTIVATE:
|
||||
if ((int)lParam !=0)
|
||||
|
@ -1032,9 +1021,13 @@ BOOL CALLBACK LoadDisplayMonitorInfo(HMONITOR hMonitor,
|
|||
hwnd = CreateWindowEx(estyle | WS_EX_LAYERED,
|
||||
"GNUstepWindowClass",
|
||||
"GNUstepWindow",
|
||||
wstyle,
|
||||
r.left,
|
||||
r.top,
|
||||
#if (BUILD_GRAPHICS==GRAPHICS_cairo)
|
||||
((wstyle & WS_POPUP) ? ((wstyle & ~WS_POPUP) | WS_OVERLAPPED) : wstyle),
|
||||
#else
|
||||
wstyle,
|
||||
#endif
|
||||
r.left,
|
||||
r.top,
|
||||
r.right - r.left,
|
||||
r.bottom - r.top,
|
||||
(HWND)NULL,
|
||||
|
@ -1042,30 +1035,25 @@ BOOL CALLBACK LoadDisplayMonitorInfo(HMONITOR hMonitor,
|
|||
hinstance,
|
||||
(void*)type);
|
||||
NSDebugLLog(@"WCTrace", @" num/handle: %d", hwnd);
|
||||
if (!hwnd)
|
||||
if (hwnd == NULL)
|
||||
{
|
||||
NSLog(@"CreateWindowEx Failed %d", GetLastError());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Borderless window request...
|
||||
{
|
||||
#if (BUILD_GRAPHICS==GRAPHICS_cairo)
|
||||
#if defined(USE_WS_POPUP)
|
||||
// Borderless window request...
|
||||
if (wstyle & WS_POPUP)
|
||||
#else
|
||||
if (style == 0)
|
||||
#endif
|
||||
{
|
||||
#ifndef USE_WS_POPUP
|
||||
LONG wstyleOld = GetWindowLong(hwnd, GWL_STYLE);
|
||||
LONG estyleOld = GetWindowLong(hwnd, GWL_EXSTYLE);
|
||||
LONG wstyleNew = (wstyleOld & ~WS_OVERLAPPEDWINDOW);
|
||||
LONG estyleNew = estyleOld | WS_EX_TOOLWINDOW;
|
||||
|
||||
NSDebugLLog(@"WCTrace", @"%s:wstyles - old: %8.8X new: %8.8X\n",
|
||||
__PRETTY_FUNCTION__, wstyleOld, wstyleNew);
|
||||
NSDebugLLog(@"WCTrace", @"%s:estyles - old: %8.8X new: %8.8X\n",
|
||||
__PRETTY_FUNCTION__, estyleOld, estyleNew);
|
||||
NSDebugMLLog(@"WCTrace", @"wstyles - old: %8.8X new: %8.8X\n",
|
||||
wstyleOld, wstyleNew);
|
||||
NSDebugMLLog(@"WCTrace", @"estyles - old: %8.8X new: %8.8X\n",
|
||||
estyleOld, estyleNew);
|
||||
|
||||
// Modify window style parameters and update the window information...
|
||||
SetWindowLong(hwnd, GWL_STYLE, wstyleNew);
|
||||
|
@ -1073,14 +1061,13 @@ BOOL CALLBACK LoadDisplayMonitorInfo(HMONITOR hMonitor,
|
|||
SetWindowPos(hwnd, NULL, 0, 0, 0, 0,
|
||||
SWP_FRAMECHANGED | SWP_NOSENDCHANGING | SWP_NOREPOSITION |
|
||||
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
SetLayeredWindowAttributes(hwnd, 0, 255, LWA_ALPHA);
|
||||
SetLayeredWindowAttributes(hwnd, 0, 255, LWA_ALPHA);
|
||||
|
||||
[self _setWindowOwnedByServer: (int)hwnd];
|
||||
}
|
||||
[self _setWindowOwnedByServer: (int)hwnd];
|
||||
}
|
||||
return (int)hwnd;
|
||||
}
|
||||
|
||||
|
@ -1166,7 +1153,7 @@ BOOL CALLBACK LoadDisplayMonitorInfo(HMONITOR hMonitor,
|
|||
- (void) miniwindow: (int) winNum
|
||||
{
|
||||
NSDebugLLog(@"WTrace", @"miniwindow: %d", winNum);
|
||||
ShowWindow((HWND)winNum, SW_MINIMIZE);
|
||||
ShowWindow((HWND)winNum, SW_MINIMIZE);
|
||||
}
|
||||
|
||||
/** Returns NO as we don't provide mini windows on MS Windows */
|
||||
|
@ -1383,7 +1370,7 @@ BOOL CALLBACK LoadDisplayMonitorInfo(HMONITOR hMonitor,
|
|||
{
|
||||
_enableCallbacks = NO;
|
||||
if (SetForegroundWindow((HWND)winNum) == 0)
|
||||
NSLog(@"%s:SetForegroundWindow error\n", __PRETTY_FUNCTION__);
|
||||
NSDebugMLLog(@"WError", @"SetForegroundWindow error for HWND: %p\n", winNum);
|
||||
_enableCallbacks = YES;
|
||||
}
|
||||
/* For debug log window stack.
|
||||
|
@ -1616,7 +1603,7 @@ BOOL CALLBACK LoadDisplayMonitorInfo(HMONITOR hMonitor,
|
|||
#elif (BUILD_GRAPHICS==GRAPHICS_cairo)
|
||||
if (win->surface == NULL)
|
||||
{
|
||||
NSLog(@"%s:NULL surface for window %p", __PRETTY_FUNCTION__, hwnd);
|
||||
NSWarnMLog(@"NULL surface for window %p", hwnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -33,34 +33,37 @@
|
|||
|
||||
- (LRESULT) decodeWM_MOVEParams:(HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam
|
||||
{
|
||||
NSPoint eventLocation;
|
||||
NSRect rect;
|
||||
RECT r;
|
||||
NSEvent *ev = nil;
|
||||
if (flags.HOLD_MINI_FOR_SIZE == FALSE)
|
||||
{
|
||||
NSPoint eventLocation;
|
||||
NSRect rect;
|
||||
RECT r;
|
||||
NSEvent *ev = nil;
|
||||
|
||||
GetWindowRect(hwnd, &r);
|
||||
rect = MSScreenRectToGS(r);
|
||||
eventLocation = rect.origin;
|
||||
|
||||
ev = [NSEvent otherEventWithType: NSAppKitDefined
|
||||
location: eventLocation
|
||||
modifierFlags: 0
|
||||
timestamp: 0
|
||||
windowNumber: (int)hwnd
|
||||
context: GSCurrentContext()
|
||||
subtype: GSAppKitWindowMoved
|
||||
data1: rect.origin.x
|
||||
data2: rect.origin.y];
|
||||
|
||||
GetWindowRect(hwnd, &r);
|
||||
rect = MSScreenRectToGS(r);
|
||||
eventLocation = rect.origin;
|
||||
|
||||
//need native code here?
|
||||
[EVENT_WINDOW(hwnd) sendEvent: ev];
|
||||
|
||||
ev = [NSEvent otherEventWithType: NSAppKitDefined
|
||||
location: eventLocation
|
||||
modifierFlags: 0
|
||||
timestamp: 0
|
||||
windowNumber: (int)hwnd
|
||||
context: GSCurrentContext()
|
||||
subtype: GSAppKitWindowMoved
|
||||
data1: rect.origin.x
|
||||
data2: rect.origin.y];
|
||||
|
||||
|
||||
//need native code here?
|
||||
[EVENT_WINDOW(hwnd) sendEvent: ev];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (LRESULT) decodeWM_SIZEParams:(HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam
|
||||
{
|
||||
{
|
||||
switch ((int)wParam)
|
||||
{
|
||||
case SIZE_MAXHIDE:
|
||||
|
@ -92,22 +95,22 @@
|
|||
NSRect rect;
|
||||
RECT r;
|
||||
NSEvent *ev =nil;
|
||||
|
||||
|
||||
GetWindowRect(hwnd, &r);
|
||||
rect = MSScreenRectToGS(r);
|
||||
eventLocation = rect.origin;
|
||||
|
||||
|
||||
// make event
|
||||
ev = [NSEvent otherEventWithType: NSAppKitDefined
|
||||
location: eventLocation
|
||||
modifierFlags: 0
|
||||
timestamp: 0
|
||||
windowNumber: (int)hwnd
|
||||
context: GSCurrentContext()
|
||||
subtype: GSAppKitWindowResized
|
||||
data1: rect.size.width
|
||||
data2: rect.size.height];
|
||||
|
||||
location: eventLocation
|
||||
modifierFlags: 0
|
||||
timestamp: 0
|
||||
windowNumber: (int)hwnd
|
||||
context: GSCurrentContext()
|
||||
subtype: GSAppKitWindowResized
|
||||
data1: rect.size.width
|
||||
data2: rect.size.height];
|
||||
|
||||
[EVENT_WINDOW(hwnd) sendEvent: ev];
|
||||
[self resizeBackingStoreFor: hwnd];
|
||||
// fixes part one of bug [5, 25] see notes
|
||||
|
@ -125,61 +128,13 @@
|
|||
return 0;
|
||||
}
|
||||
|
||||
- (void) decodeWM_NCCALCSIZEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
- (void) decodeWM_NCCALCSIZEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
{
|
||||
// stub for future dev
|
||||
|
||||
/*NCCALCSIZE_PARAMS * newRects;
|
||||
|
||||
NSPoint eventLocation;
|
||||
NSRect rect;
|
||||
RECT drect;
|
||||
NSEvent *ev =nil;
|
||||
|
||||
if (wParam == TRUE)
|
||||
{
|
||||
// get first rect from NCCALCSIZE_PARAMS Structure
|
||||
newRects=(NCCALCSIZE_PARAMS *)lParam;
|
||||
// get rect 1 from array
|
||||
drect=newRects->rgrc[1];
|
||||
|
||||
//create a size event and send it to the window
|
||||
rect = MSScreenRectToGS(drect);
|
||||
eventLocation = rect.origin;
|
||||
|
||||
// make event
|
||||
ev = [NSEvent otherEventWithType: NSAppKitDefined
|
||||
location: eventLocation
|
||||
modifierFlags: 0
|
||||
timestamp: 0
|
||||
windowNumber: (int)hwnd
|
||||
context: GSCurrentContext()
|
||||
subtype: GSAppKitWindowResized
|
||||
data1: rect.size.width
|
||||
data2: rect.size.height];
|
||||
|
||||
[EVENT_WINDOW(hwnd) sendEvent:ev];*/
|
||||
//[[EVENT_WINDOW(hwnd) contentView] display];
|
||||
//[self resizeBackingStoreFor:hwnd];
|
||||
|
||||
|
||||
/* ev = [NSEvent otherEventWithType: NSAppKitDefined
|
||||
location: eventLocation
|
||||
modifierFlags: 0
|
||||
timestamp: 0
|
||||
windowNumber: (int)hwnd
|
||||
context: GSCurrentContext()
|
||||
subtype: GSAppKitWindowMoved
|
||||
data1: rect.origin.x
|
||||
data2: rect.origin.y];
|
||||
|
||||
[EVENT_WINDOW(hwnd) sendEvent:ev];
|
||||
|
||||
//printf(" Rect 1 =\n%s", [[self MSRectDetails:drect] cString]);
|
||||
|
||||
}
|
||||
|
||||
//printf("wParam is %s\n", wParam ? "TRUE" : "FALSE");*/
|
||||
#if 0
|
||||
DefWindowProc(hwnd, WM_NCCALCSIZE, wParam, lParam);
|
||||
flags._eventHandled = YES;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
- (void) decodeWM_WINDOWPOSCHANGEDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
|
@ -196,34 +151,34 @@
|
|||
/* For debugging, log current window stack.
|
||||
*/
|
||||
if (GSDebugSet(@"WTrace") == YES)
|
||||
{
|
||||
NSString *s = @"Window list:\n";
|
||||
{
|
||||
NSString *s = @"Window list:\n";
|
||||
|
||||
hi = GetDesktopWindow();
|
||||
hi = GetWindow(hi, GW_CHILD);
|
||||
if (hi > 0)
|
||||
{
|
||||
hi = GetWindow(hi, GW_HWNDLAST);
|
||||
}
|
||||
while (hi > 0)
|
||||
{
|
||||
TCHAR buf[32];
|
||||
hi = GetDesktopWindow();
|
||||
hi = GetWindow(hi, GW_CHILD);
|
||||
if (hi > 0)
|
||||
{
|
||||
hi = GetWindow(hi, GW_HWNDLAST);
|
||||
}
|
||||
while (hi > 0)
|
||||
{
|
||||
TCHAR buf[32];
|
||||
|
||||
hi = GetNextWindow(hi, GW_HWNDPREV);
|
||||
hi = GetNextWindow(hi, GW_HWNDPREV);
|
||||
|
||||
if (hi > 0
|
||||
&& GetClassName(hi, buf, 32) == 18
|
||||
&& strncmp(buf, "GNUstepWindowClass", 18) == 0)
|
||||
{
|
||||
if (GetWindowLong(hi, OFF_ORDERED) == 1)
|
||||
{
|
||||
hl = GetWindowLong(hi, OFF_LEVEL);
|
||||
s = [s stringByAppendingFormat: @"%d (%d)\n", hi, hl];
|
||||
}
|
||||
}
|
||||
}
|
||||
NSLog(@"window pos changed: %@", s);
|
||||
}
|
||||
if (hi > 0
|
||||
&& GetClassName(hi, buf, 32) == 18
|
||||
&& strncmp(buf, "GNUstepWindowClass", 18) == 0)
|
||||
{
|
||||
if (GetWindowLong(hi, OFF_ORDERED) == 1)
|
||||
{
|
||||
hl = GetWindowLong(hi, OFF_LEVEL);
|
||||
s = [s stringByAppendingFormat: @"%d (%d)\n", hi, hl];
|
||||
}
|
||||
}
|
||||
}
|
||||
NSLog(@"window pos changed: %@", s);
|
||||
}
|
||||
|
||||
/* This window has changed its z-order, so we take the opportunity
|
||||
* to check that all the GNUstep windows are in the correct order
|
||||
|
@ -236,76 +191,76 @@
|
|||
hi = GetDesktopWindow();
|
||||
hi = GetWindow(hi, GW_CHILD);
|
||||
while (hi > 0)
|
||||
{
|
||||
TCHAR buf[32];
|
||||
{
|
||||
TCHAR buf[32];
|
||||
|
||||
/* Find a GNUstep window which is ordered in and above desktop
|
||||
*/
|
||||
while (hi > 0)
|
||||
{
|
||||
if (GetClassName(hi, buf, 32) == 18
|
||||
&& strncmp(buf, "GNUstepWindowClass", 18) == 0
|
||||
&& GetWindowLong(hi, OFF_ORDERED) == 1
|
||||
&& (hl = GetWindowLong(hi, OFF_LEVEL))
|
||||
> NSDesktopWindowLevel)
|
||||
{
|
||||
break;
|
||||
}
|
||||
hi = GetNextWindow(hi, GW_HWNDNEXT);
|
||||
}
|
||||
|
||||
if (hi > 0)
|
||||
{
|
||||
NSDebugLLog(@"WTrace", @"sort hi %d (%d)", hi, hl);
|
||||
/* Find the next (lower in z-order) GNUstep window which
|
||||
* is ordered in and above desktop
|
||||
*/
|
||||
lo = GetNextWindow(hi, GW_HWNDNEXT);
|
||||
while (lo > 0)
|
||||
{
|
||||
if (GetClassName(lo, buf, 32) == 18
|
||||
&& strncmp(buf, "GNUstepWindowClass", 18) == 0
|
||||
&& GetWindowLong(lo, OFF_ORDERED) == 1
|
||||
&& (ll = GetWindowLong(lo, OFF_LEVEL))
|
||||
> NSDesktopWindowLevel)
|
||||
{
|
||||
break;
|
||||
}
|
||||
lo = GetNextWindow(lo, GW_HWNDNEXT);
|
||||
}
|
||||
/* Find a GNUstep window which is ordered in and above desktop
|
||||
*/
|
||||
while (hi > 0)
|
||||
{
|
||||
if (GetClassName(hi, buf, 32) == 18
|
||||
&& strncmp(buf, "GNUstepWindowClass", 18) == 0
|
||||
&& GetWindowLong(hi, OFF_ORDERED) == 1
|
||||
&& (hl = GetWindowLong(hi, OFF_LEVEL))
|
||||
> NSDesktopWindowLevel)
|
||||
{
|
||||
break;
|
||||
}
|
||||
hi = GetNextWindow(hi, GW_HWNDNEXT);
|
||||
}
|
||||
|
||||
if (hi > 0)
|
||||
{
|
||||
NSDebugLLog(@"WTrace", @"sort hi %d (%d)", hi, hl);
|
||||
/* Find the next (lower in z-order) GNUstep window which
|
||||
* is ordered in and above desktop
|
||||
*/
|
||||
lo = GetNextWindow(hi, GW_HWNDNEXT);
|
||||
while (lo > 0)
|
||||
{
|
||||
if (GetClassName(lo, buf, 32) == 18
|
||||
&& strncmp(buf, "GNUstepWindowClass", 18) == 0
|
||||
&& GetWindowLong(lo, OFF_ORDERED) == 1
|
||||
&& (ll = GetWindowLong(lo, OFF_LEVEL))
|
||||
> NSDesktopWindowLevel)
|
||||
{
|
||||
break;
|
||||
}
|
||||
lo = GetNextWindow(lo, GW_HWNDNEXT);
|
||||
}
|
||||
|
||||
if (lo > 0)
|
||||
{
|
||||
NSDebugLLog(@"WTrace", @"sort lo %d (%d)", lo, ll);
|
||||
/* Check to see if the higher of the two windows should
|
||||
* actually be lower.
|
||||
*/
|
||||
if (hl < ll)
|
||||
{
|
||||
HWND higher;
|
||||
if (lo > 0)
|
||||
{
|
||||
NSDebugLLog(@"WTrace", @"sort lo %d (%d)", lo, ll);
|
||||
/* Check to see if the higher of the two windows should
|
||||
* actually be lower.
|
||||
*/
|
||||
if (hl < ll)
|
||||
{
|
||||
HWND higher;
|
||||
|
||||
/* Insert the low window before the high one.
|
||||
* ie after the window preceding the high one.
|
||||
*/
|
||||
higher = GetNextWindow(hi, GW_HWNDPREV);
|
||||
if (higher == 0)
|
||||
{
|
||||
higher = HWND_TOP;
|
||||
}
|
||||
NSDebugLLog(@"WTrace", @"swap %d (%d) with %d (%d)", hi, hl, lo, ll);
|
||||
SetWindowPos(lo, higher, 0, 0, 0, 0,
|
||||
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
|
||||
/* Insert the low window before the high one.
|
||||
* ie after the window preceding the high one.
|
||||
*/
|
||||
higher = GetNextWindow(hi, GW_HWNDPREV);
|
||||
if (higher == 0)
|
||||
{
|
||||
higher = HWND_TOP;
|
||||
}
|
||||
NSDebugLLog(@"WTrace", @"swap %d (%d) with %d (%d)", hi, hl, lo, ll);
|
||||
SetWindowPos(lo, higher, 0, 0, 0, 0,
|
||||
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
|
||||
|
||||
/* Done this iteration of the sort ... the next
|
||||
* iteration takes place when we get notified
|
||||
* that the swap we have just donew is complete.
|
||||
*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
hi = lo;
|
||||
}
|
||||
}
|
||||
/* Done this iteration of the sort ... the next
|
||||
* iteration takes place when we get notified
|
||||
* that the swap we have just donew is complete.
|
||||
*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
hi = lo;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -321,9 +276,9 @@ NSDebugLLog(@"WTrace", @"swap %d (%d) with %d (%d)", hi, hl, lo, ll);
|
|||
* desktop level window is inserted below them.
|
||||
*/
|
||||
if (GetWindowLong(hwnd, OFF_LEVEL) <= NSDesktopWindowLevel)
|
||||
{
|
||||
inf->hwndInsertAfter = HWND_BOTTOM;
|
||||
}
|
||||
{
|
||||
inf->hwndInsertAfter = HWND_BOTTOM;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -344,6 +299,11 @@ NSDebugLLog(@"WTrace", @"swap %d (%d) with %d (%d)", hi, hl, lo, ll);
|
|||
return 0;
|
||||
}
|
||||
|
||||
- (LRESULT) decodeWM_ENTERSIZEMOVEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
{
|
||||
return DefWindowProc(hwnd, WM_ENTERSIZEMOVE, wParam, lParam);
|
||||
}
|
||||
|
||||
- (LRESULT) decodeWM_EXITSIZEMOVEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
{
|
||||
// may have a small bug here note it for follow up
|
||||
|
@ -352,11 +312,11 @@ NSDebugLLog(@"WTrace", @"swap %d (%d) with %d (%d)", hi, hl, lo, ll);
|
|||
no posting is needed.
|
||||
*/
|
||||
[self resizeBackingStoreFor: hwnd];
|
||||
[self decodeWM_MOVEParams:hwnd :wParam :lParam];
|
||||
[self decodeWM_SIZEParams:hwnd :wParam :lParam];
|
||||
|
||||
// [self decodeWM_MOVEParams:hwnd :wParam :lParam];
|
||||
// [self decodeWM_SIZEParams:hwnd :wParam :lParam];
|
||||
|
||||
//Make sure DefWindowProc gets called
|
||||
return 0;
|
||||
return DefWindowProc(hwnd, WM_EXITSIZEMOVE, wParam, lParam);
|
||||
}
|
||||
|
||||
- (LRESULT) decodeWM_SIZINGParams:(HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam
|
||||
|
@ -367,10 +327,10 @@ NSDebugLLog(@"WTrace", @"swap %d (%d) with %d (%d)", hi, hl, lo, ll);
|
|||
|
||||
- (LRESULT) decodeWM_MOVINGParams:(HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam
|
||||
{
|
||||
// stub for future dev
|
||||
[self decodeWM_MOVEParams:(HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam];
|
||||
// [self decodeWM_MOVEParams:(HWND)hwnd : (WPARAM)wParam : (LPARAM)lParam];
|
||||
[EVENT_WINDOW(hwnd) display];
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -66,7 +66,7 @@ invalidateWindow(WIN32Server *svr, HWND hwnd, RECT rect)
|
|||
win->hdc, rect.left, rect.top, SRCCOPY);
|
||||
if (!result)
|
||||
{
|
||||
NSLog(@"validateWindow failed %d", GetLastError());
|
||||
NSWarnMLog(@"validateWindow failed %d", GetLastError());
|
||||
}
|
||||
ReleaseDC((HWND)hwnd, hdc);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue