mirror of
https://github.com/gnustep/libs-back.git
synced 2025-04-22 15:31:14 +00:00
commit
3b90116f44
9 changed files with 71 additions and 54 deletions
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
2021-03-03 Riccardo Mottola <rm@gnu.org>
|
||||
|
||||
* Source/win32/WIN32Server.m:
|
||||
actually store in a LONG_PTR the result of GetWindowLongPtr
|
||||
|
||||
2021-03-02 Riccardo Mottola <rm@gnu.org>
|
||||
|
||||
* Source/win32/WIN32Server.m
|
||||
* Source/win32/w32_create.m
|
||||
* Source/win32/w32_general.m
|
||||
* Source/win32/w32_movesize.m
|
||||
* Source/win32/w32_windowdisplay.m
|
||||
* Source/winlib/WIN32GState.m
|
||||
* Source/cairo/Win32CairoGlitzSurface.m:
|
||||
Consistently use 64bit safe SetWindowLongPtr/GetWindowLongPtr instead
|
||||
of a mix with old 32bit versions.
|
||||
|
||||
2021-01-27 Sergii Stoian <stoyan255@gmail.com>
|
||||
|
||||
* Source/x11/XGServerWindow.m (_checkStyle:): do not set application
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
gsDevice = device;
|
||||
GetClientRect(GSWINDEVICE, &sz);
|
||||
win = (WIN_INTERN *)GetWindowLong(GSWINDEVICE, GWL_USERDATA);
|
||||
win = (WIN_INTERN *)GetWindowLongPtr(GSWINDEVICE, GWLP_USERDATA);
|
||||
if (win && win->useHDC)
|
||||
{
|
||||
HGDIOBJ old;
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
{
|
||||
if (self)
|
||||
{
|
||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong((HWND)device, GWL_USERDATA);
|
||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLongPtr((HWND)device, GWLP_USERDATA);
|
||||
HDC hDC = GetDC((HWND)device);
|
||||
|
||||
// Save/set initial state...
|
||||
|
|
|
@ -700,7 +700,7 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
|
|||
- (void) resizeBackingStoreFor: (HWND)hwnd
|
||||
{
|
||||
#if (BUILD_GRAPHICS==GRAPHICS_winlib)
|
||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong((HWND)hwnd, GWL_USERDATA);
|
||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLongPtr((HWND)hwnd, GWLP_USERDATA);
|
||||
|
||||
// FIXME: We should check if the size really did change.
|
||||
if (win->useHDC)
|
||||
|
@ -1635,10 +1635,10 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
|
|||
// Borderless window request...
|
||||
if (wstyle & 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;
|
||||
LONG_PTR wstyleOld = GetWindowLongPtr(hwnd, GWL_STYLE);
|
||||
LONG_PTR estyleOld = GetWindowLongPtr(hwnd, GWL_EXSTYLE);
|
||||
LONG_PTR wstyleNew = (wstyleOld & ~WS_OVERLAPPEDWINDOW);
|
||||
LONG_PTR estyleNew = estyleOld | WS_EX_TOOLWINDOW;
|
||||
|
||||
NSDebugMLLog(@"WCTrace", @"wstyles - old: %8.8X new: %8.8X\n",
|
||||
wstyleOld, wstyleNew);
|
||||
|
@ -1646,8 +1646,8 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
|
|||
estyleOld, estyleNew);
|
||||
|
||||
// Modify window style parameters and update the window information...
|
||||
SetWindowLong(hwnd, GWL_STYLE, wstyleNew);
|
||||
SetWindowLong(hwnd, GWL_EXSTYLE, estyleNew);
|
||||
SetWindowLongPtr(hwnd, GWL_STYLE, wstyleNew);
|
||||
SetWindowLongPtr(hwnd, GWL_EXSTYLE, estyleNew);
|
||||
SetWindowPos(hwnd, NULL, 0, 0, 0, 0,
|
||||
SWP_FRAMECHANGED | SWP_NOSENDCHANGING | SWP_NOREPOSITION |
|
||||
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
|
||||
|
@ -1678,8 +1678,8 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
|
|||
@"-stylewindow: : called when [self handlesWindowDecorations] == NO");
|
||||
|
||||
NSDebugLLog(@"WTrace", @"stylewindow: %d : %d", style, winNum);
|
||||
SetWindowLong((HWND)winNum, GWL_STYLE, wstyle);
|
||||
SetWindowLong((HWND)winNum, GWL_EXSTYLE, estyle);
|
||||
SetWindowLongPtr((HWND)winNum, GWL_STYLE, wstyle);
|
||||
SetWindowLongPtr((HWND)winNum, GWL_EXSTYLE, estyle);
|
||||
}
|
||||
|
||||
- (void) setbackgroundcolor: (NSColor *)color : (int)win
|
||||
|
@ -1689,7 +1689,7 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
|
|||
/** Changes window's the backing store to type */
|
||||
- (void) windowbacking: (NSBackingStoreType)type : (int) winNum
|
||||
{
|
||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong((HWND)winNum, GWL_USERDATA);
|
||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLongPtr((HWND)winNum, GWLP_USERDATA);
|
||||
|
||||
NSDebugLLog(@"WTrace", @"windowbacking: %d : %d", type, winNum);
|
||||
#if (BUILD_GRAPHICS==GRAPHICS_winlib)
|
||||
|
@ -1817,7 +1817,7 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
|
|||
|
||||
if (op == NSWindowOut)
|
||||
{
|
||||
SetWindowLong((HWND)winNum, OFF_ORDERED, 0);
|
||||
SetWindowLongPtr((HWND)winNum, OFF_ORDERED, 0);
|
||||
ShowWindow((HWND)winNum, SW_HIDE);
|
||||
return;
|
||||
}
|
||||
|
@ -1835,10 +1835,10 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
|
|||
}
|
||||
|
||||
ShowWindow((HWND)winNum, flag);
|
||||
SetWindowLong((HWND)winNum, OFF_ORDERED, 1);
|
||||
SetWindowLongPtr((HWND)winNum, OFF_ORDERED, 1);
|
||||
|
||||
// Process window leveling...
|
||||
level = GetWindowLong((HWND)winNum, OFF_LEVEL);
|
||||
level = GetWindowLongPtr((HWND)winNum, OFF_LEVEL);
|
||||
|
||||
if (otherWin <= 0)
|
||||
{
|
||||
|
@ -1863,14 +1863,14 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
|
|||
/* Put this on the same window level as the window we are ordering
|
||||
* it against.
|
||||
*/
|
||||
otherLevel = GetWindowLong((HWND)otherWin, OFF_LEVEL);
|
||||
otherLevel = GetWindowLongPtr((HWND)otherWin, OFF_LEVEL);
|
||||
if (level != otherLevel)
|
||||
{
|
||||
NSDebugLLog(@"WTrace",
|
||||
@"orderwindow: implicitly set level of %d (%d) to that of %d (%d)",
|
||||
winNum, level, otherWin, otherLevel);
|
||||
level = otherLevel;
|
||||
SetWindowLong((HWND)winNum, OFF_LEVEL, level);
|
||||
SetWindowLongPtr((HWND)winNum, OFF_LEVEL, level);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1917,9 +1917,9 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
|
|||
&& GetClassName((HWND)otherWin, buf, 32) == 18
|
||||
&& strncmp(buf, "GNUstepWindowClass", 18) == 0)
|
||||
{
|
||||
if (GetWindowLong((HWND)otherWin, OFF_ORDERED) == 1)
|
||||
if (GetWindowLongPtr((HWND)otherWin, OFF_ORDERED) == 1)
|
||||
{
|
||||
otherLevel = GetWindowLong((HWND)otherWin, OFF_LEVEL);
|
||||
otherLevel = GetWindowLongPtr((HWND)otherWin, OFF_LEVEL);
|
||||
NSDebugLLog(@"WTrace", @"orderwindow: found gnustep window %d (%d)",
|
||||
otherWin, otherLevel);
|
||||
if (otherLevel >= level)
|
||||
|
@ -2000,9 +2000,9 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
|
|||
&& GetClassName((HWND)otherWin, buf, 32) == 18
|
||||
&& strncmp(buf, "GNUstepWindowClass", 18) == 0)
|
||||
{
|
||||
if (GetWindowLong((HWND)otherWin, OFF_ORDERED) == 1)
|
||||
if (GetWindowLongPtr((HWND)otherWin, OFF_ORDERED) == 1)
|
||||
{
|
||||
otherLevel = GetWindowLong((HWND)otherWin, OFF_LEVEL);
|
||||
otherLevel = GetWindowLongPtr((HWND)otherWin, OFF_LEVEL);
|
||||
s = [s stringByAppendingFormat:
|
||||
@"%d (%d)\n", otherWin, otherLevel];
|
||||
}
|
||||
|
@ -2039,7 +2039,7 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
|
|||
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
|
||||
|
||||
#if (BUILD_GRAPHICS==GRAPHICS_winlib)
|
||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong((HWND)winNum, GWL_USERDATA);
|
||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLongPtr((HWND)winNum, GWLP_USERDATA);
|
||||
|
||||
if ((win->useHDC)
|
||||
&& (r.right - r.left != r2.right - r2.left)
|
||||
|
@ -2084,10 +2084,10 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
|
|||
- (void) setwindowlevel: (int) level : (int) winNum
|
||||
{
|
||||
NSDebugLLog(@"WTrace", @"setwindowlevel: %d : %d", level, winNum);
|
||||
if (GetWindowLong((HWND)winNum, OFF_LEVEL) != level)
|
||||
if (GetWindowLongPtr((HWND)winNum, OFF_LEVEL) != level)
|
||||
{
|
||||
SetWindowLong((HWND)winNum, OFF_LEVEL, level);
|
||||
if (GetWindowLong((HWND)winNum, OFF_ORDERED) == YES)
|
||||
SetWindowLongPtr((HWND)winNum, OFF_LEVEL, level);
|
||||
if (GetWindowLongPtr((HWND)winNum, OFF_ORDERED) == YES)
|
||||
{
|
||||
[self orderwindow: NSWindowAbove : 0 : winNum];
|
||||
}
|
||||
|
@ -2096,7 +2096,7 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
|
|||
|
||||
- (int) windowlevel: (int) winNum
|
||||
{
|
||||
return GetWindowLong((HWND)winNum, OFF_LEVEL);
|
||||
return GetWindowLongPtr((HWND)winNum, OFF_LEVEL);
|
||||
}
|
||||
|
||||
- (NSArray *) windowlist
|
||||
|
@ -2144,7 +2144,7 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
|
|||
/** Set the maximum size of the window */
|
||||
- (void) setmaxsize: (NSSize)size : (int) winNum
|
||||
{
|
||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong((HWND)winNum, GWL_USERDATA);
|
||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLongPtr((HWND)winNum, GWLP_USERDATA);
|
||||
POINT p;
|
||||
|
||||
p.x = size.width;
|
||||
|
@ -2154,20 +2154,20 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
|
|||
// Disable the maximize box if a maximum size is set
|
||||
if (size.width < 10000 || size.height < 10000)
|
||||
{
|
||||
SetWindowLong((HWND)winNum, GWL_STYLE,
|
||||
GetWindowLong((HWND)winNum, GWL_STYLE) ^ WS_MAXIMIZEBOX);
|
||||
SetWindowLongPtr((HWND)winNum, GWL_STYLE,
|
||||
GetWindowLongPtr((HWND)winNum, GWL_STYLE) ^ WS_MAXIMIZEBOX);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetWindowLong((HWND)winNum, GWL_STYLE,
|
||||
GetWindowLong((HWND)winNum, GWL_STYLE) | WS_MAXIMIZEBOX);
|
||||
SetWindowLongPtr((HWND)winNum, GWL_STYLE,
|
||||
GetWindowLongPtr((HWND)winNum, GWL_STYLE) | WS_MAXIMIZEBOX);
|
||||
}
|
||||
}
|
||||
|
||||
/** Set the minimum size of the window */
|
||||
- (void) setminsize: (NSSize)size : (int) winNum
|
||||
{
|
||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong((HWND)winNum, GWL_USERDATA);
|
||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLongPtr((HWND)winNum, GWLP_USERDATA);
|
||||
POINT p;
|
||||
|
||||
p.x = size.width;
|
||||
|
@ -2183,7 +2183,7 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
|
|||
- (void) flushwindowrect: (NSRect)rect : (int)winNum
|
||||
{
|
||||
HWND hwnd = (HWND)winNum;
|
||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong(hwnd, GWL_USERDATA);
|
||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
|
||||
if (win)
|
||||
{
|
||||
|
@ -2290,15 +2290,15 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
|
|||
{
|
||||
if (alpha > 0.99)
|
||||
{
|
||||
SetWindowLong((HWND)win, GWL_EXSTYLE,
|
||||
GetWindowLong((HWND)win, GWL_EXSTYLE) & ~WS_EX_LAYERED);
|
||||
SetWindowLongPtr((HWND)win, GWL_EXSTYLE,
|
||||
GetWindowLongPtr((HWND)win, GWL_EXSTYLE) & ~WS_EX_LAYERED);
|
||||
RedrawWindow((HWND)win, NULL, NULL,
|
||||
RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetWindowLong((HWND)win, GWL_EXSTYLE,
|
||||
GetWindowLong((HWND)win, GWL_EXSTYLE) | WS_EX_LAYERED);
|
||||
SetWindowLongPtr((HWND)win, GWL_EXSTYLE,
|
||||
GetWindowLongPtr((HWND)win, GWL_EXSTYLE) | WS_EX_LAYERED);
|
||||
SetLayeredWindowAttributes((HWND)win, 0, 255 * alpha, LWA_ALPHA);
|
||||
}
|
||||
}
|
||||
|
@ -2430,15 +2430,15 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
|
|||
|
||||
- (void) setIgnoreMouse: (BOOL)ignoreMouse : (int)win
|
||||
{
|
||||
int extendedStyle = GetWindowLong((HWND)win, GWL_EXSTYLE);
|
||||
int extendedStyle = GetWindowLongPtr((HWND)win, GWL_EXSTYLE);
|
||||
|
||||
if (ignoreMouse)
|
||||
{
|
||||
SetWindowLong((HWND)win, GWL_EXSTYLE, extendedStyle | WS_EX_TRANSPARENT);
|
||||
SetWindowLongPtr((HWND)win, GWL_EXSTYLE, extendedStyle | WS_EX_TRANSPARENT);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetWindowLong((HWND)win, GWL_EXSTYLE, extendedStyle & ~WS_EX_TRANSPARENT);
|
||||
SetWindowLongPtr((HWND)win, GWL_EXSTYLE, extendedStyle & ~WS_EX_TRANSPARENT);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,8 +68,8 @@
|
|||
win->useHDC = NO;
|
||||
|
||||
// Save win internals structure pointer for window handle...
|
||||
SetWindowLong(hwnd, GWL_USERDATA, (int)win);
|
||||
SetWindowLongPtr(hwnd, IME_INFO, (LONG)ime);
|
||||
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)win);
|
||||
SetWindowLongPtr(hwnd, IME_INFO, (LONG_PTR)ime);
|
||||
|
||||
[self windowbacking: type : (int)hwnd];
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
|
||||
- (void) decodeWM_DESTROYParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
{
|
||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong(hwnd, GWL_USERDATA);
|
||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
|
||||
// Clean up window-specific data objects.
|
||||
|
||||
|
|
|
@ -170,9 +170,9 @@
|
|||
&& GetClassName(hi, buf, 32) == 18
|
||||
&& strncmp(buf, "GNUstepWindowClass", 18) == 0)
|
||||
{
|
||||
if (GetWindowLong(hi, OFF_ORDERED) == 1)
|
||||
if (GetWindowLongPtr(hi, OFF_ORDERED) == 1)
|
||||
{
|
||||
hl = GetWindowLong(hi, OFF_LEVEL);
|
||||
hl = GetWindowLongPtr(hi, OFF_LEVEL);
|
||||
s = [s stringByAppendingFormat: @"%d (%d)\n", hi, hl];
|
||||
}
|
||||
}
|
||||
|
@ -200,8 +200,8 @@
|
|||
{
|
||||
if (GetClassName(hi, buf, 32) == 18
|
||||
&& strncmp(buf, "GNUstepWindowClass", 18) == 0
|
||||
&& GetWindowLong(hi, OFF_ORDERED) == 1
|
||||
&& (hl = GetWindowLong(hi, OFF_LEVEL))
|
||||
&& GetWindowLongPtr(hi, OFF_ORDERED) == 1
|
||||
&& (hl = GetWindowLongPtr(hi, OFF_LEVEL))
|
||||
> NSDesktopWindowLevel)
|
||||
{
|
||||
break;
|
||||
|
@ -220,8 +220,8 @@
|
|||
{
|
||||
if (GetClassName(lo, buf, 32) == 18
|
||||
&& strncmp(buf, "GNUstepWindowClass", 18) == 0
|
||||
&& GetWindowLong(lo, OFF_ORDERED) == 1
|
||||
&& (ll = GetWindowLong(lo, OFF_LEVEL))
|
||||
&& GetWindowLongPtr(lo, OFF_ORDERED) == 1
|
||||
&& (ll = GetWindowLongPtr(lo, OFF_LEVEL))
|
||||
> NSDesktopWindowLevel)
|
||||
{
|
||||
break;
|
||||
|
@ -275,7 +275,7 @@
|
|||
* to ensure that they are at the bottom unless another
|
||||
* desktop level window is inserted below them.
|
||||
*/
|
||||
if (GetWindowLong(hwnd, OFF_LEVEL) <= NSDesktopWindowLevel)
|
||||
if (GetWindowLongPtr(hwnd, OFF_LEVEL) <= NSDesktopWindowLevel)
|
||||
{
|
||||
inf->hwndInsertAfter = HWND_BOTTOM;
|
||||
}
|
||||
|
@ -284,7 +284,7 @@
|
|||
|
||||
- (LRESULT) decodeWM_GETMINMAXINFOParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
|
||||
{
|
||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong(hwnd, GWL_USERDATA);
|
||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
MINMAXINFO *mm;
|
||||
|
||||
if (win != NULL)
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
static void
|
||||
invalidateWindow(WIN32Server *svr, HWND hwnd, RECT rect)
|
||||
{
|
||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong((HWND)hwnd, GWL_USERDATA);
|
||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLongPtr((HWND)hwnd, GWLP_USERDATA);
|
||||
|
||||
if (!win->useHDC || win->backingStoreEmpty)
|
||||
{
|
||||
|
|
|
@ -1449,7 +1449,7 @@ HBITMAP GSCreateBitmap(HDC hDC, NSInteger pixelsWide, NSInteger pixelsHigh,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
win = (WIN_INTERN *)GetWindowLong((HWND)window, GWL_USERDATA);
|
||||
win = (WIN_INTERN *)GetWindowLongPtr((HWND)window, GWLP_USERDATA);
|
||||
if (win && win->useHDC)
|
||||
{
|
||||
hDC = win->hdc;
|
||||
|
@ -1482,7 +1482,7 @@ HBITMAP GSCreateBitmap(HDC hDC, NSInteger pixelsWide, NSInteger pixelsHigh,
|
|||
}
|
||||
|
||||
[self restoreStyle: hDC];
|
||||
win = (WIN_INTERN *)GetWindowLong((HWND)window, GWL_USERDATA);
|
||||
win = (WIN_INTERN *)GetWindowLongPtr((HWND)window, GWLP_USERDATA);
|
||||
if (win && !win->useHDC)
|
||||
ReleaseDC((HWND)window, hDC);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue