mirror of
https://github.com/gnustep/libs-back.git
synced 2025-06-01 01:41:00 +00:00
Update for coordinate mapping changes.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@23473 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
657222ee92
commit
32d2f9faca
5 changed files with 86 additions and 106 deletions
|
@ -19,7 +19,8 @@
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with this library; if not, write to the Free
|
License along with this library; if not, write to the Free
|
||||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02111 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _WIN32Geometry_h_INCLUDE
|
#ifndef _WIN32Geometry_h_INCLUDE
|
||||||
|
@ -29,70 +30,69 @@
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
static inline
|
@class WIN32Server;
|
||||||
NSPoint MSWindowPointToGS(HWND hwnd, int x, int y)
|
|
||||||
|
static inline NSPoint
|
||||||
|
MSWindowPointToGS(WIN32Server *svr, HWND hwnd, int x, int y)
|
||||||
{
|
{
|
||||||
|
NSGraphicsContext *ctxt;
|
||||||
|
RECT rect;
|
||||||
|
float h, l, r, t, b;
|
||||||
NSPoint p1;
|
NSPoint p1;
|
||||||
RECT rect;
|
NSWindow *window;
|
||||||
int h;
|
|
||||||
|
|
||||||
|
ctxt = GSCurrentContext();
|
||||||
|
window = GSWindowWithNumber((int)hwnd);
|
||||||
GetClientRect(hwnd, &rect);
|
GetClientRect(hwnd, &rect);
|
||||||
h = rect.bottom - rect.top;
|
h = rect.bottom - rect.top;
|
||||||
|
[svr styleoffsets: &l : &r : &t : &b : [window styleMask]];
|
||||||
|
|
||||||
p1.x = x;
|
p1.x = x + l;
|
||||||
p1.y = h - y;
|
p1.y = h - y + b;
|
||||||
return p1;
|
return p1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline
|
static inline NSRect
|
||||||
POINT GSWindowPointToMS(HWND hwnd, NSPoint p)
|
MSWindowRectToGS(WIN32Server *svr, HWND hwnd, RECT r0)
|
||||||
{
|
{
|
||||||
POINT p1;
|
NSGraphicsContext *ctxt;
|
||||||
RECT rect;
|
RECT rect;
|
||||||
int h;
|
float h, l, r, t, b;
|
||||||
|
|
||||||
GetClientRect(hwnd, &rect);
|
|
||||||
h = rect.bottom - rect.top;
|
|
||||||
|
|
||||||
p1.x = p.x;
|
|
||||||
p1.y = h -p.y;
|
|
||||||
|
|
||||||
return p1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
NSRect MSWindowRectToGS(HWND hwnd, RECT r)
|
|
||||||
{
|
|
||||||
NSRect r1;
|
NSRect r1;
|
||||||
RECT rect;
|
NSWindow *window;
|
||||||
int h;
|
|
||||||
|
|
||||||
|
ctxt = GSCurrentContext();
|
||||||
|
window = GSWindowWithNumber((int)hwnd);
|
||||||
GetClientRect(hwnd, &rect);
|
GetClientRect(hwnd, &rect);
|
||||||
h = rect.bottom - rect.top;
|
h = rect.bottom - rect.top;
|
||||||
|
[svr styleoffsets: &l : &r : &t : &b : [window styleMask]];
|
||||||
|
|
||||||
r1.origin.x = r.left;
|
r1.origin.x = r0.left + l;
|
||||||
r1.origin.y = h - r.bottom;
|
r1.origin.y = h - r0.bottom + b;
|
||||||
r1.size.width = r.right - r.left;
|
r1.size.width = r0.right - r0.left;
|
||||||
r1.size.height = r.bottom -r.top;
|
r1.size.height = r0.bottom - r0.top;
|
||||||
|
|
||||||
return r1;
|
return r1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline
|
static inline RECT
|
||||||
RECT GSWindowRectToMS(HWND hwnd, NSRect r)
|
GSWindowRectToMS(WIN32Server *svr, HWND hwnd, NSRect r0)
|
||||||
{
|
{
|
||||||
RECT r1;
|
NSGraphicsContext *ctxt;
|
||||||
RECT rect;
|
RECT rect;
|
||||||
int h;
|
float h, l, r, t, b;
|
||||||
|
RECT r1;
|
||||||
|
NSWindow *window;
|
||||||
|
|
||||||
|
ctxt = GSCurrentContext();
|
||||||
|
window = GSWindowWithNumber((int)hwnd);
|
||||||
GetClientRect(hwnd, &rect);
|
GetClientRect(hwnd, &rect);
|
||||||
h = rect.bottom - rect.top;
|
h = rect.bottom - rect.top;
|
||||||
|
[svr styleoffsets: &l : &r : &t : &b : [window styleMask]];
|
||||||
|
|
||||||
r1.left = r.origin.x;
|
r1.left = r0.origin.x - l;
|
||||||
r1.bottom = h - r.origin.y;
|
r1.bottom = h - r0.origin.y + b;
|
||||||
r1.right = r.origin.x + r.size.width;
|
r1.right = r1.left + r0.size.width;
|
||||||
r1.top = h - r.origin.y - r.size.height;
|
r1.top = r1.bottom - r0.size.height;
|
||||||
|
|
||||||
return r1;
|
return r1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,20 +145,12 @@ NSRect MSScreenRectToGS(RECT r, unsigned int styleMask, WIN32Server *self)
|
||||||
{
|
{
|
||||||
NSRect r1;
|
NSRect r1;
|
||||||
int screen_height = GetSystemMetrics(SM_CYSCREEN);
|
int screen_height = GetSystemMetrics(SM_CYSCREEN);
|
||||||
float t, b, l, rr;
|
|
||||||
|
|
||||||
[self styleoffsets: &l : &rr : &t : &b : styleMask];
|
|
||||||
|
|
||||||
r1.origin.x = r.left;
|
r1.origin.x = r.left;
|
||||||
r1.origin.y = screen_height - r.bottom;
|
r1.origin.y = screen_height - r.bottom;
|
||||||
r1.size.width = r.right - r.left;
|
r1.size.width = r.right - r.left;
|
||||||
r1.size.height = r.bottom - r.top;
|
r1.size.height = r.bottom - r.top;
|
||||||
|
|
||||||
r1.origin.x += l;
|
|
||||||
r1.origin.y += b;
|
|
||||||
r1.size.width -= l + rr;
|
|
||||||
r1.size.height -= t + b;
|
|
||||||
|
|
||||||
return r1;
|
return r1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,14 +170,6 @@ RECT GSScreenRectToMS(NSRect r, unsigned int styleMask, WIN32Server *self)
|
||||||
{
|
{
|
||||||
RECT r1;
|
RECT r1;
|
||||||
int screen_height = GetSystemMetrics(SM_CYSCREEN);
|
int screen_height = GetSystemMetrics(SM_CYSCREEN);
|
||||||
float t, b, l, rr;
|
|
||||||
|
|
||||||
[self styleoffsets: &l : &rr : &t : &b : styleMask];
|
|
||||||
|
|
||||||
r.origin.x -= l;
|
|
||||||
r.origin.y -= b;
|
|
||||||
r.size.width += l + rr;
|
|
||||||
r.size.height += t + b;
|
|
||||||
|
|
||||||
r1.left = r.origin.x;
|
r1.left = r.origin.x;
|
||||||
r1.bottom = screen_height - r.origin.y;
|
r1.bottom = screen_height - r.origin.y;
|
||||||
|
|
|
@ -18,7 +18,8 @@
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with this library; if not, write to the Free
|
License along with this library; if not, write to the Free
|
||||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02111 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <GNUstepGUI/GSDisplayServer.h>
|
#include <GNUstepGUI/GSDisplayServer.h>
|
||||||
|
|
|
@ -21,7 +21,8 @@
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
License along with this library; if not, write to the Free
|
License along with this library; if not, write to the Free
|
||||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02111 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Foundation/NSDebug.h>
|
#include <Foundation/NSDebug.h>
|
||||||
|
@ -58,16 +59,16 @@ static NSString *NSMenuWillTearOff = @"MenuWillTearOff";
|
||||||
static NSString *NSMenuwillPopUP =@"MenuwillPopUP";
|
static NSString *NSMenuwillPopUP =@"MenuwillPopUP";
|
||||||
static NSString *NSWindowDidCreateWindow =@"WindowDidCreateWindow";
|
static NSString *NSWindowDidCreateWindow =@"WindowDidCreateWindow";
|
||||||
|
|
||||||
static NSEvent *process_key_event(HWND hwnd, WPARAM wParam, LPARAM lParam,
|
static NSEvent *process_key_event(WIN32Server *svr,
|
||||||
NSEventType eventType);
|
HWND hwnd, WPARAM wParam, LPARAM lParam, NSEventType eventType);
|
||||||
static NSEvent *process_mouse_event(HWND hwnd, WPARAM wParam, LPARAM lParam,
|
static NSEvent *process_mouse_event(WIN32Server *svr,
|
||||||
NSEventType eventType);
|
HWND hwnd, WPARAM wParam, LPARAM lParam, NSEventType eventType);
|
||||||
|
|
||||||
//static BOOL HAVE_MAIN_MENU = NO;
|
//static BOOL HAVE_MAIN_MENU = NO;
|
||||||
static BOOL handlesWindowDecorations = NO;
|
static BOOL handlesWindowDecorations = NO;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
validateWindow(HWND hwnd, RECT rect);
|
validateWindow(WIN32Server *svr, HWND hwnd, RECT rect);
|
||||||
LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
||||||
WPARAM wParam, LPARAM lParam);
|
WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
|
@ -1409,27 +1410,27 @@ printf("\n\n##############################################################\n");
|
||||||
break;
|
break;
|
||||||
case WM_MOUSEMOVE: //MOUSE
|
case WM_MOUSEMOVE: //MOUSE
|
||||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "MOUSEMOVE", hwnd);
|
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "MOUSEMOVE", hwnd);
|
||||||
ev = process_mouse_event(hwnd, wParam, lParam, NSMouseMoved);
|
ev = process_mouse_event(self, hwnd, wParam, lParam, NSMouseMoved);
|
||||||
break;
|
break;
|
||||||
case WM_LBUTTONDOWN: //MOUSE
|
case WM_LBUTTONDOWN: //MOUSE
|
||||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "LBUTTONDOWN", hwnd);
|
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "LBUTTONDOWN", hwnd);
|
||||||
//[self decodeWM_LBUTTONDOWNParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd];
|
//[self decodeWM_LBUTTONDOWNParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd];
|
||||||
ev = process_mouse_event(hwnd, wParam, lParam, NSLeftMouseDown);
|
ev = process_mouse_event(self, hwnd, wParam, lParam, NSLeftMouseDown);
|
||||||
break;
|
break;
|
||||||
case WM_LBUTTONUP: //MOUSE
|
case WM_LBUTTONUP: //MOUSE
|
||||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "LBUTTONUP", hwnd);
|
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "LBUTTONUP", hwnd);
|
||||||
ev = process_mouse_event(hwnd, wParam, lParam, NSLeftMouseUp);
|
ev = process_mouse_event(self, hwnd, wParam, lParam, NSLeftMouseUp);
|
||||||
break;
|
break;
|
||||||
case WM_LBUTTONDBLCLK: //MOUSE
|
case WM_LBUTTONDBLCLK: //MOUSE
|
||||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "LBUTTONDBLCLK", hwnd);
|
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "LBUTTONDBLCLK", hwnd);
|
||||||
break;
|
break;
|
||||||
case WM_MBUTTONDOWN: //MOUSE
|
case WM_MBUTTONDOWN: //MOUSE
|
||||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "MBUTTONDOWN", hwnd);
|
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "MBUTTONDOWN", hwnd);
|
||||||
ev = process_mouse_event(hwnd, wParam, lParam, NSOtherMouseDown);
|
ev = process_mouse_event(self, hwnd, wParam, lParam, NSOtherMouseDown);
|
||||||
break;
|
break;
|
||||||
case WM_MBUTTONUP: //MOUSE
|
case WM_MBUTTONUP: //MOUSE
|
||||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "MBUTTONUP", hwnd);
|
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "MBUTTONUP", hwnd);
|
||||||
ev = process_mouse_event(hwnd, wParam, lParam, NSOtherMouseUp);
|
ev = process_mouse_event(self, hwnd, wParam, lParam, NSOtherMouseUp);
|
||||||
break;
|
break;
|
||||||
case WM_MBUTTONDBLCLK: //MOUSE
|
case WM_MBUTTONDBLCLK: //MOUSE
|
||||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "MBUTTONDBLCLK", hwnd);
|
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "MBUTTONDBLCLK", hwnd);
|
||||||
|
@ -1437,13 +1438,13 @@ printf("\n\n##############################################################\n");
|
||||||
case WM_RBUTTONDOWN: //MOUSE
|
case WM_RBUTTONDOWN: //MOUSE
|
||||||
{
|
{
|
||||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "RBUTTONDOWN", hwnd);
|
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "RBUTTONDOWN", hwnd);
|
||||||
ev = process_mouse_event(hwnd, wParam, lParam, NSRightMouseDown);
|
ev = process_mouse_event(self, hwnd, wParam, lParam, NSRightMouseDown);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WM_RBUTTONUP: //MOUSE
|
case WM_RBUTTONUP: //MOUSE
|
||||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "RBUTTONUP", hwnd);
|
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "RBUTTONUP", hwnd);
|
||||||
{
|
{
|
||||||
ev = process_mouse_event(hwnd, wParam, lParam, NSRightMouseUp);
|
ev = process_mouse_event(self, hwnd, wParam, lParam, NSRightMouseUp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WM_RBUTTONDBLCLK: //MOUSE
|
case WM_RBUTTONDBLCLK: //MOUSE
|
||||||
|
@ -1451,16 +1452,16 @@ printf("\n\n##############################################################\n");
|
||||||
break;
|
break;
|
||||||
case WM_MOUSEWHEEL: //MOUSE
|
case WM_MOUSEWHEEL: //MOUSE
|
||||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "MOUSEWHEEL", hwnd);
|
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "MOUSEWHEEL", hwnd);
|
||||||
ev = process_mouse_event(hwnd, wParam, lParam, NSScrollWheel);
|
ev = process_mouse_event(self, hwnd, wParam, lParam, NSScrollWheel);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_KEYDOWN: //KEYBOARD
|
case WM_KEYDOWN: //KEYBOARD
|
||||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "KEYDOWN", hwnd);
|
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "KEYDOWN", hwnd);
|
||||||
ev = process_key_event(hwnd, wParam, lParam, NSKeyDown);
|
ev = process_key_event(self, hwnd, wParam, lParam, NSKeyDown);
|
||||||
break;
|
break;
|
||||||
case WM_KEYUP: //KEYBOARD
|
case WM_KEYUP: //KEYBOARD
|
||||||
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "KEYUP", hwnd);
|
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "KEYUP", hwnd);
|
||||||
ev = process_key_event(hwnd, wParam, lParam, NSKeyUp);
|
ev = process_key_event(self, hwnd, wParam, lParam, NSKeyUp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_POWERBROADCAST: //SYSTEM
|
case WM_POWERBROADCAST: //SYSTEM
|
||||||
|
@ -1708,10 +1709,17 @@ printf("\n\n##############################################################\n");
|
||||||
- (void) windowdevice: (int) winNum
|
- (void) windowdevice: (int) winNum
|
||||||
{
|
{
|
||||||
NSGraphicsContext *ctxt;
|
NSGraphicsContext *ctxt;
|
||||||
|
RECT rect;
|
||||||
|
float h, l, r, t, b;
|
||||||
|
NSWindow *window;
|
||||||
|
|
||||||
NSDebugLLog(@"WTrace", @"windowdevice: %d", winNum);
|
NSDebugLLog(@"WTrace", @"windowdevice: %d", winNum);
|
||||||
ctxt = GSCurrentContext();
|
ctxt = GSCurrentContext();
|
||||||
GSSetDevice(ctxt, (void*)winNum, 0, 0);
|
window = GSWindowWithNumber(winNum);
|
||||||
|
GetClientRect((HWND)winNum, &rect);
|
||||||
|
h = rect.bottom - rect.top;
|
||||||
|
[self styleoffsets: &l : &r : &t : &b : [window styleMask]];
|
||||||
|
GSSetDevice(ctxt, (void*)winNum, l, h + b);
|
||||||
DPSinitmatrix(ctxt);
|
DPSinitmatrix(ctxt);
|
||||||
DPSinitclip(ctxt);
|
DPSinitclip(ctxt);
|
||||||
}
|
}
|
||||||
|
@ -1894,8 +1902,8 @@ printf("\n\n##############################################################\n");
|
||||||
/** Causes buffered graphics to be flushed to the screen */
|
/** Causes buffered graphics to be flushed to the screen */
|
||||||
- (void) flushwindowrect: (NSRect)rect : (int) winNum
|
- (void) flushwindowrect: (NSRect)rect : (int) winNum
|
||||||
{
|
{
|
||||||
RECT r = GSWindowRectToMS((HWND)winNum, rect);
|
RECT r = GSWindowRectToMS(self, (HWND)winNum, rect);
|
||||||
validateWindow((HWND)winNum, r);
|
validateWindow(self, (HWND)winNum, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) styleoffsets: (float *) l : (float *) r : (float *) t : (float *) b
|
- (void) styleoffsets: (float *) l : (float *) r : (float *) t : (float *) b
|
||||||
|
@ -2137,7 +2145,7 @@ process_char(WPARAM wParam, unsigned *eventModifierFlags)
|
||||||
}
|
}
|
||||||
|
|
||||||
static NSEvent*
|
static NSEvent*
|
||||||
process_key_event(HWND hwnd, WPARAM wParam, LPARAM lParam,
|
process_key_event(WIN32Server *svr, HWND hwnd, WPARAM wParam, LPARAM lParam,
|
||||||
NSEventType eventType)
|
NSEventType eventType)
|
||||||
{
|
{
|
||||||
NSEvent *event;
|
NSEvent *event;
|
||||||
|
@ -2162,7 +2170,7 @@ process_key_event(HWND hwnd, WPARAM wParam, LPARAM lParam,
|
||||||
|
|
||||||
pos = GetMessagePos();
|
pos = GetMessagePos();
|
||||||
eventLocation
|
eventLocation
|
||||||
= MSWindowPointToGS(hwnd, GET_X_LPARAM(pos), GET_Y_LPARAM(pos));
|
= MSWindowPointToGS(svr, hwnd, GET_X_LPARAM(pos), GET_Y_LPARAM(pos));
|
||||||
|
|
||||||
ltime = GetMessageTime();
|
ltime = GetMessageTime();
|
||||||
time = ltime / 1000;
|
time = ltime / 1000;
|
||||||
|
@ -2255,7 +2263,7 @@ process_key_event(HWND hwnd, WPARAM wParam, LPARAM lParam,
|
||||||
}
|
}
|
||||||
|
|
||||||
static NSEvent*
|
static NSEvent*
|
||||||
process_mouse_event(HWND hwnd, WPARAM wParam, LPARAM lParam,
|
process_mouse_event(WIN32Server *svr, HWND hwnd, WPARAM wParam, LPARAM lParam,
|
||||||
NSEventType eventType)
|
NSEventType eventType)
|
||||||
{
|
{
|
||||||
NSEvent *event;
|
NSEvent *event;
|
||||||
|
@ -2270,7 +2278,7 @@ process_mouse_event(HWND hwnd, WPARAM wParam, LPARAM lParam,
|
||||||
static LONG lastTime = 0;
|
static LONG lastTime = 0;
|
||||||
|
|
||||||
gcontext = GSCurrentContext();
|
gcontext = GSCurrentContext();
|
||||||
eventLocation = MSWindowPointToGS(hwnd, GET_X_LPARAM(lParam),
|
eventLocation = MSWindowPointToGS(svr, hwnd, GET_X_LPARAM(lParam),
|
||||||
GET_Y_LPARAM(lParam));
|
GET_Y_LPARAM(lParam));
|
||||||
ltime = GetMessageTime();
|
ltime = GetMessageTime();
|
||||||
time = ltime / 1000;
|
time = ltime / 1000;
|
||||||
|
@ -2355,7 +2363,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
validateWindow(HWND hwnd, RECT rect)
|
validateWindow(WIN32Server *svr, HWND hwnd, RECT rect)
|
||||||
{
|
{
|
||||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong((HWND)hwnd, GWL_USERDATA);
|
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong((HWND)hwnd, GWL_USERDATA);
|
||||||
|
|
||||||
|
@ -2370,7 +2378,7 @@ validateWindow(HWND hwnd, RECT rect)
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
NSLog(@"validated window %d %@", hwnd,
|
NSLog(@"validated window %d %@", hwnd,
|
||||||
NSStringFromRect(MSWindowRectToGS((HWND)hwnd, rect)));
|
NSStringFromRect(MSWindowRectToGS(svr, (HWND)hwnd, rect)));
|
||||||
NSLog(@"validateWindow failed %d", GetLastError());
|
NSLog(@"validateWindow failed %d", GetLastError());
|
||||||
}
|
}
|
||||||
ReleaseDC((HWND)hwnd, hdc);
|
ReleaseDC((HWND)hwnd, hdc);
|
||||||
|
|
|
@ -27,10 +27,10 @@
|
||||||
|
|
||||||
#include "w32_Events.h"
|
#include "w32_Events.h"
|
||||||
|
|
||||||
static void invalidateWindow(HWND hwnd, RECT rect);
|
static void invalidateWindow(WIN32Server *svr, HWND hwnd, RECT rect);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
invalidateWindow(HWND hwnd, RECT rect)
|
invalidateWindow(WIN32Server *svr, HWND hwnd, RECT rect)
|
||||||
{
|
{
|
||||||
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong((HWND)hwnd, GWL_USERDATA);
|
WIN_INTERN *win = (WIN_INTERN *)GetWindowLong((HWND)hwnd, GWL_USERDATA);
|
||||||
|
|
||||||
|
@ -44,8 +44,6 @@ invalidateWindow(HWND hwnd, RECT rect)
|
||||||
win->hdc, rect.left, rect.top, SRCCOPY);
|
win->hdc, rect.left, rect.top, SRCCOPY);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
NSLog(@"validated window %d %@", hwnd,
|
|
||||||
NSStringFromRect(MSWindowRectToGS((HWND)hwnd, rect)));
|
|
||||||
NSLog(@"validateWindow failed %d", GetLastError());
|
NSLog(@"validateWindow failed %d", GetLastError());
|
||||||
}
|
}
|
||||||
ReleaseDC((HWND)hwnd, hdc);
|
ReleaseDC((HWND)hwnd, hdc);
|
||||||
|
@ -53,14 +51,14 @@ invalidateWindow(HWND hwnd, RECT rect)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NSWindow *window = GSWindowWithNumber((int)hwnd);
|
NSWindow *window = GSWindowWithNumber((int)hwnd);
|
||||||
NSRect r = MSWindowRectToGS((HWND)hwnd, rect);
|
NSRect r = MSWindowRectToGS(svr, (HWND)hwnd, rect);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
NSLog(@"Invalidated window %d %@ (%d, %d, %d, %d)", hwnd,
|
NSLog(@"Invalidated window %d %@ (%d, %d, %d, %d)", hwnd,
|
||||||
NSStringFromRect(r), rect.left, rect.top, rect.right, rect.bottom);
|
NSStringFromRect(r), rect.left, rect.top, rect.right, rect.bottom);
|
||||||
*/
|
*/
|
||||||
// Repaint the window's client area.
|
// Repaint the window's client area.
|
||||||
[[window contentView] setNeedsDisplayInRect: r];
|
[[[window contentView] superview] setNeedsDisplayInRect: r];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,7 +240,7 @@ invalidateWindow(HWND hwnd, RECT rect)
|
||||||
{
|
{
|
||||||
//InvalidateRect(hwnd,rect,YES);
|
//InvalidateRect(hwnd,rect,YES);
|
||||||
|
|
||||||
invalidateWindow(hwnd, rect);
|
invalidateWindow(self, hwnd, rect);
|
||||||
// validate the whole window, for in some cases an infinite series
|
// validate the whole window, for in some cases an infinite series
|
||||||
// of WM_PAINT is triggered
|
// of WM_PAINT is triggered
|
||||||
ValidateRect(hwnd, NULL);
|
ValidateRect(hwnd, NULL);
|
||||||
|
|
|
@ -82,14 +82,9 @@ static inline
|
||||||
POINT GSWindowPointToMS(WIN32GState *s, NSPoint p)
|
POINT GSWindowPointToMS(WIN32GState *s, NSPoint p)
|
||||||
{
|
{
|
||||||
POINT p1;
|
POINT p1;
|
||||||
int h;
|
|
||||||
|
|
||||||
h = WindowHeight([s window]);
|
p1.x = p.x - s->offset.x;
|
||||||
|
p1.y = s->offset.y - p.y;
|
||||||
p.x += s->offset.x;
|
|
||||||
p.y += s->offset.y;
|
|
||||||
p1.x = p.x;
|
|
||||||
p1.y = h - p.y;
|
|
||||||
|
|
||||||
return p1;
|
return p1;
|
||||||
}
|
}
|
||||||
|
@ -98,17 +93,11 @@ static inline
|
||||||
RECT GSWindowRectToMS(WIN32GState *s, NSRect r)
|
RECT GSWindowRectToMS(WIN32GState *s, NSRect r)
|
||||||
{
|
{
|
||||||
RECT r1;
|
RECT r1;
|
||||||
int h;
|
|
||||||
|
|
||||||
h = WindowHeight([s window]);
|
r1.left = r.origin.x - s->offset.x;
|
||||||
|
r1.bottom = s->offset.y - r.origin.y;
|
||||||
r.origin.x += s->offset.x;
|
r1.right = r1.left + r.size.width;
|
||||||
r.origin.y += s->offset.y;
|
r1.top = r1.bottom - r.size.height;
|
||||||
|
|
||||||
r1.left = r.origin.x;
|
|
||||||
r1.right = r.origin.x + r.size.width;
|
|
||||||
r1.bottom = h - r.origin.y;
|
|
||||||
r1.top = h - r.origin.y - r.size.height;
|
|
||||||
|
|
||||||
return r1;
|
return r1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue