mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-23 03:41:04 +00:00
* Headers/win32/WIN32Server.h:
* Source/win32/WIN32Server.m: * Source/win32/w32_movesize.m: Fix a rather serious error where the extra window data was allocated in two places (allocated with objc_malloc in the WM_CREATE handler, and also allocated by Windows using the cbWndExtra field of the window class structure). Sometimes the window level was accessed from one memory area and sometimes from the other. This is a quick fix that leaves the level and ordered properties in the cbWndExtra area, and the rest is left in the WIN_INTERN structure. This fixes the problem where window ordering was broken when running apps in gdb. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@31198 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d963ba552d
commit
b7ff3b2973
4 changed files with 35 additions and 16 deletions
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
2010-08-24 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Headers/win32/WIN32Server.h:
|
||||
* Source/win32/WIN32Server.m:
|
||||
* Source/win32/w32_movesize.m:
|
||||
Fix a rather serious error where the extra window data was allocated
|
||||
in two places (allocated with objc_malloc in the WM_CREATE handler,
|
||||
and also allocated by Windows using the cbWndExtra field of the window
|
||||
class structure). Sometimes the window level was accessed from one
|
||||
memory area and sometimes from the other.
|
||||
|
||||
This is a quick fix that leaves the level and ordered properties
|
||||
in the cbWndExtra area, and the rest is left in the WIN_INTERN
|
||||
structure.
|
||||
|
||||
This fixes the problem where window ordering was broken when running
|
||||
apps in gdb.
|
||||
|
||||
2010-08-24 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/win32/WIN32Server.m (-setmaxsize::):
|
||||
|
|
|
@ -182,11 +182,18 @@ typedef struct w32serverFlags {
|
|||
|
||||
@end
|
||||
|
||||
typedef struct _win_intern {
|
||||
int32_t level;
|
||||
// FIXME: Keep all of the extra window data in one place
|
||||
|
||||
// Extra window data accessed via GetWindowLong
|
||||
|
||||
#define OFF_LEVEL 0
|
||||
int32_t orderedIn;
|
||||
#define OFF_ORDERED sizeof(int32_t)
|
||||
#define OFF_ORDERED sizeof(DWORD)
|
||||
#define WIN_EXTRABYTES (2*sizeof(DWORD))
|
||||
|
||||
// Extra window data allocated using objc_malloc in WM_CREATE and accessed via
|
||||
// the GWL_USERDATA pointer
|
||||
|
||||
typedef struct _win_intern {
|
||||
BOOL useHDC;
|
||||
BOOL backingStoreEmpty;
|
||||
HDC hdc;
|
||||
|
|
|
@ -197,8 +197,8 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
|||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.lpfnWndProc = (WNDPROC) MainWndProc;
|
||||
wc.cbClsExtra = 0;
|
||||
// Keep extra space for each window, for GS data
|
||||
wc.cbWndExtra = sizeof(WIN_INTERN);
|
||||
// Keep extra space for each window, for OFF_LEVEL and OFF_ORDERED
|
||||
wc.cbWndExtra = WIN_EXTRABYTES;
|
||||
wc.hInstance = hinstance;
|
||||
wc.hIcon = NULL;//currentAppIcon;
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
|
@ -1314,13 +1314,11 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
|||
|
||||
- (void) setwindowlevel: (int) level : (int) winNum
|
||||
{
|
||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLongPtr((HWND)winNum, GWLP_USERDATA);
|
||||
|
||||
NSDebugLLog(@"WTrace", @"setwindowlevel: %d : %d", level, winNum);
|
||||
if (win->level != level)
|
||||
if (GetWindowLong((HWND)winNum, OFF_LEVEL) != level)
|
||||
{
|
||||
SetWindowLong((HWND)winNum, OFF_LEVEL, level);
|
||||
if (win->orderedIn == YES)
|
||||
if (GetWindowLong((HWND)winNum, OFF_ORDERED) == YES)
|
||||
{
|
||||
[self orderwindow: NSWindowAbove : 0 : winNum];
|
||||
}
|
||||
|
@ -1329,8 +1327,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
|||
|
||||
- (int) windowlevel: (int) winNum
|
||||
{
|
||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLongPtr((HWND)winNum, GWLP_USERDATA);
|
||||
return win->level;
|
||||
return GetWindowLong((HWND)winNum, OFF_LEVEL);
|
||||
}
|
||||
|
||||
- (NSArray *) windowlist
|
||||
|
|
|
@ -315,15 +315,12 @@ NSDebugLLog(@"WTrace", @"swap %d (%d) with %d (%d)", hi, hl, lo, ll);
|
|||
|
||||
if ((inf->flags & SWP_NOZORDER) == 0)
|
||||
{
|
||||
WIN_INTERN *win;
|
||||
|
||||
/* desktop level windows should stay at the bottom of the
|
||||
* window list, so we can simply override any re-ordering
|
||||
* to ensure that they are at the bottom unless another
|
||||
* desktop level window is inserted below them.
|
||||
*/
|
||||
win = (WIN_INTERN *)GetWindowLong(hwnd, GWL_USERDATA);
|
||||
if (win->level <= NSDesktopWindowLevel)
|
||||
if (GetWindowLong(hwnd, OFF_LEVEL) <= NSDesktopWindowLevel)
|
||||
{
|
||||
inf->hwndInsertAfter = HWND_BOTTOM;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue