mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-05 03:15:07 -04:00
Imbedded hacks for osx
This commit is contained in:
parent
facb94eea5
commit
0aedd3fdd8
@ -33,12 +33,83 @@
|
|||||||
#include <AGL/agl.h>
|
#include <AGL/agl.h>
|
||||||
#include <ApplicationServices/ApplicationServices.h>
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
|
|
||||||
|
#include "pmutex.h"
|
||||||
|
//#include "mutexHolder.h"
|
||||||
|
|
||||||
|
////////////////////////////////////
|
||||||
|
|
||||||
|
\
|
||||||
|
Mutex & OSXGloablMutex()
|
||||||
|
{
|
||||||
|
static Mutex m("OSXWIN_Mutex");
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct work1
|
||||||
|
{
|
||||||
|
volatile bool work_done;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define PANDA_CREATE_WINDOW 101
|
||||||
|
static void Post_Event_Wiait(unsigned short type, unsigned int data1 , unsigned int data2 , int target_window )
|
||||||
|
{
|
||||||
|
work1 w;
|
||||||
|
w.work_done = false;
|
||||||
|
NSEvent *ev = [NSEvent otherEventWithType:NSApplicationDefined
|
||||||
|
location:NSZeroPoint
|
||||||
|
modifierFlags:0
|
||||||
|
timestamp:0.0f
|
||||||
|
windowNumber:target_window
|
||||||
|
context:nil
|
||||||
|
subtype:type
|
||||||
|
data1:data1
|
||||||
|
data2:(int)&w];
|
||||||
|
|
||||||
|
[NSApp postEvent:ev atStart:NO];
|
||||||
|
while(!w.work_done)
|
||||||
|
usleep(10);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////// Global Objects .....
|
////////////////////////// Global Objects .....
|
||||||
|
|
||||||
TypeHandle osxGraphicsWindow::_type_handle;
|
TypeHandle osxGraphicsWindow::_type_handle;
|
||||||
osxGraphicsWindow * osxGraphicsWindow::FullScreenWindow = NULL;
|
osxGraphicsWindow * osxGraphicsWindow::FullScreenWindow = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
#define USER_CONTAINER
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
|
||||||
|
#ifdef USER_CONTAINER
|
||||||
|
|
||||||
|
std::set< WindowRef > MyWindows;
|
||||||
|
void AddAWindow( WindowRef window)
|
||||||
|
{
|
||||||
|
MyWindows.insert(window);
|
||||||
|
}
|
||||||
|
bool checkmywindow(WindowRef window)
|
||||||
|
{
|
||||||
|
return MyWindows.find(window) != MyWindows.end();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
void AddAWindow( WindowRef window)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool checkmywindow(WindowRef window)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: GetCurrentOSxWindow
|
// Function: GetCurrentOSxWindow
|
||||||
// Access: Static,
|
// Access: Static,
|
||||||
@ -59,8 +130,11 @@ osxGraphicsWindow* osxGraphicsWindow::GetCurrentOSxWindow(WindowRef window)
|
|||||||
window = FrontNonFloatingWindow();
|
window = FrontNonFloatingWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window)
|
if (window && checkmywindow(window))
|
||||||
|
//if (window )
|
||||||
|
{
|
||||||
return (osxGraphicsWindow *)GetWRefCon (window);
|
return (osxGraphicsWindow *)GetWRefCon (window);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -171,6 +245,7 @@ static void CompositeGLBufferIntoWindow (AGLContext ctx, Rect *bufferRect, GrafP
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
OSStatus osxGraphicsWindow::event_handler(EventHandlerCallRef myHandler, EventRef event)
|
OSStatus osxGraphicsWindow::event_handler(EventHandlerCallRef myHandler, EventRef event)
|
||||||
{
|
{
|
||||||
|
|
||||||
OSStatus result = eventNotHandledErr;
|
OSStatus result = eventNotHandledErr;
|
||||||
UInt32 the_class = GetEventClass(event);
|
UInt32 the_class = GetEventClass(event);
|
||||||
UInt32 kind = GetEventKind(event);
|
UInt32 kind = GetEventKind(event);
|
||||||
@ -287,11 +362,12 @@ void osxGraphicsWindow::SystemCloseWindow()
|
|||||||
// handle system window events..
|
// handle system window events..
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static pascal OSStatus windowEvtHndlr(EventHandlerCallRef myHandler, EventRef event, void *userData)
|
static pascal OSStatus windowEvtHndlr(EventHandlerCallRef myHandler, EventRef event, void *userData)
|
||||||
{
|
{
|
||||||
#pragma unused (userData)
|
#pragma unused (userData)
|
||||||
|
|
||||||
|
// volatile().lock();
|
||||||
|
|
||||||
WindowRef window = NULL;
|
WindowRef window = NULL;
|
||||||
GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL, sizeof(WindowRef), NULL, &window);
|
GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL, sizeof(WindowRef), NULL, &window);
|
||||||
|
|
||||||
@ -299,9 +375,13 @@ static pascal OSStatus windowEvtHndlr(EventHandlerCallRef myHandler, EventRef ev
|
|||||||
{
|
{
|
||||||
osxGraphicsWindow *osx_win = osxGraphicsWindow::GetCurrentOSxWindow(window);
|
osxGraphicsWindow *osx_win = osxGraphicsWindow::GetCurrentOSxWindow(window);
|
||||||
if (osx_win != (osxGraphicsWindow *)NULL)
|
if (osx_win != (osxGraphicsWindow *)NULL)
|
||||||
|
{
|
||||||
|
//OSXGloablMutex().release();
|
||||||
return osx_win->event_handler(myHandler, event);
|
return osx_win->event_handler(myHandler, event);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//OSXGloablMutex().release();
|
||||||
return eventNotHandledErr;
|
return eventNotHandledErr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,8 +435,11 @@ void osxGraphicsWindow::DoResize(void)
|
|||||||
static pascal OSStatus appEvtHndlr (EventHandlerCallRef myHandler, EventRef event, void* userData)
|
static pascal OSStatus appEvtHndlr (EventHandlerCallRef myHandler, EventRef event, void* userData)
|
||||||
{
|
{
|
||||||
#pragma unused (myHandler)
|
#pragma unused (myHandler)
|
||||||
|
|
||||||
OSStatus result = eventNotHandledErr;
|
OSStatus result = eventNotHandledErr;
|
||||||
|
{
|
||||||
|
|
||||||
|
//OSXGloablMutex().lock();
|
||||||
|
|
||||||
osxGraphicsWindow *osx_win = NULL;
|
osxGraphicsWindow *osx_win = NULL;
|
||||||
WindowRef window = NULL;
|
WindowRef window = NULL;
|
||||||
UInt32 the_class = GetEventClass (event);
|
UInt32 the_class = GetEventClass (event);
|
||||||
@ -365,7 +448,10 @@ static pascal OSStatus appEvtHndlr (EventHandlerCallRef myHandler, EventRef even
|
|||||||
GetEventParameter(event, kEventParamWindowRef, typeWindowRef, NULL, sizeof(WindowRef), NULL, (void*) &window);
|
GetEventParameter(event, kEventParamWindowRef, typeWindowRef, NULL, sizeof(WindowRef), NULL, (void*) &window);
|
||||||
osx_win = osxGraphicsWindow::GetCurrentOSxWindow(window);
|
osx_win = osxGraphicsWindow::GetCurrentOSxWindow(window);
|
||||||
if (osx_win == NULL)
|
if (osx_win == NULL)
|
||||||
|
{
|
||||||
|
//OSXGloablMutex().release();
|
||||||
return eventNotHandledErr;
|
return eventNotHandledErr;
|
||||||
|
}
|
||||||
|
|
||||||
switch (the_class)
|
switch (the_class)
|
||||||
{
|
{
|
||||||
@ -410,6 +496,10 @@ static pascal OSStatus appEvtHndlr (EventHandlerCallRef myHandler, EventRef even
|
|||||||
//result = noErr;
|
//result = noErr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//OSXGloablMutex().release();
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -686,7 +776,8 @@ bool osxGraphicsWindow::set_icon_filename(const Filename &icon_filename)
|
|||||||
// window.
|
// window.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void osxGraphicsWindow::
|
void osxGraphicsWindow::
|
||||||
set_pointer_in_window(int x, int y) {
|
set_pointer_in_window(int x, int y)
|
||||||
|
{
|
||||||
_input_devices[0].set_pointer_in_window(x, y);
|
_input_devices[0].set_pointer_in_window(x, y);
|
||||||
|
|
||||||
if (_cursor_hidden != _display_hide_cursor) {
|
if (_cursor_hidden != _display_hide_cursor) {
|
||||||
@ -907,7 +998,7 @@ void osxGraphicsWindow::close_window()
|
|||||||
// UInt32 lo;
|
// UInt32 lo;
|
||||||
// UInt32 hi;
|
// UInt32 hi;
|
||||||
// };
|
// };
|
||||||
//
|
///
|
||||||
//extern OSErr CPSGetCurrentProcess(CPSProcessSerNum *psn);
|
//extern OSErr CPSGetCurrentProcess(CPSProcessSerNum *psn);
|
||||||
//extern OSErr CPSEnableForegroundOperation( struct CPSProcessSerNum *psn);
|
//extern OSErr CPSEnableForegroundOperation( struct CPSProcessSerNum *psn);
|
||||||
//extern OSErr CPSSetProcessName ( struct CPSProcessSerNum *psn, char *processname);
|
//extern OSErr CPSSetProcessName ( struct CPSProcessSerNum *psn, char *processname);
|
||||||
@ -930,7 +1021,10 @@ bool osxGraphicsWindow::open_window()
|
|||||||
_gsg = new osxGraphicsStateGuardian(_pipe, NULL);
|
_gsg = new osxGraphicsStateGuardian(_pipe, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OSOpenWindow(req_properties);
|
//OSXGloablMutex().lock();
|
||||||
|
bool answer = OSOpenWindow(req_properties);
|
||||||
|
//OSXGloablMutex().release();
|
||||||
|
return answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -946,13 +1040,15 @@ bool osxGraphicsWindow::OSOpenWindow(WindowProperties &req_properties)
|
|||||||
_current_icon = NULL;
|
_current_icon = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static bool GlobalInits = false;
|
static bool GlobalInits = false;
|
||||||
if (!GlobalInits)
|
if (!GlobalInits)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// one time aplication inits.. to get a window open from a standalone aplication..
|
// one time aplication inits.. to get a window open from a standalone aplication..
|
||||||
|
|
||||||
EventHandlerRef ref1;
|
EventHandlerRef application_event_ref_ref1;
|
||||||
EventTypeSpec list1[] =
|
EventTypeSpec list1[] =
|
||||||
{
|
{
|
||||||
//{ kEventClassCommand, kEventProcessCommand },
|
//{ kEventClassCommand, kEventProcessCommand },
|
||||||
@ -970,28 +1066,12 @@ bool osxGraphicsWindow::OSOpenWindow(WindowProperties &req_properties)
|
|||||||
};
|
};
|
||||||
|
|
||||||
EventHandlerUPP gEvtHandler = NewEventHandlerUPP(appEvtHndlr);
|
EventHandlerUPP gEvtHandler = NewEventHandlerUPP(appEvtHndlr);
|
||||||
err = InstallApplicationEventHandler (gEvtHandler, GetEventTypeCount (list1) , list1, this, &ref1 );
|
err = InstallApplicationEventHandler (gEvtHandler, GetEventTypeCount (list1) , list1, this, &application_event_ref_ref1 );
|
||||||
GlobalInits = true;
|
GlobalInits = true;
|
||||||
|
|
||||||
// Replicating the hacky code with more document/support code which should do the same thing
|
|
||||||
|
|
||||||
ProcessSerialNumber psn = { 0, kCurrentProcess };
|
ProcessSerialNumber psn = { 0, kCurrentProcess };
|
||||||
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
|
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
|
||||||
SetFrontProcess(&psn);
|
SetFrontProcess(&psn);
|
||||||
|
|
||||||
// Hacky code
|
|
||||||
|
|
||||||
// struct CPSProcessSerNum PSN;
|
|
||||||
// GetCurrentProcess((ProcessSerialNumber *)&PSN);
|
|
||||||
// err = CPSGetCurrentProcess(&PSN);
|
|
||||||
|
|
||||||
// if (req_properties.has_title())
|
|
||||||
// err = CPSSetProcessName(&PSN,(char *)req_properties.get_title().c_str());
|
|
||||||
// else
|
|
||||||
// err = CPSSetProcessName(&PSN,"");
|
|
||||||
|
|
||||||
// err = CPSEnableForegroundOperation(&PSN);
|
|
||||||
// err = CPSSetFrontProcess(&PSN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req_properties.has_fullscreen() && req_properties.get_fullscreen())
|
if (req_properties.has_fullscreen() && req_properties.get_fullscreen())
|
||||||
@ -1037,7 +1117,6 @@ bool osxGraphicsWindow::OSOpenWindow(WindowProperties &req_properties)
|
|||||||
}
|
}
|
||||||
|
|
||||||
_properties.set_fullscreen(true);
|
_properties.set_fullscreen(true);
|
||||||
|
|
||||||
_is_fullscreen =true;
|
_is_fullscreen =true;
|
||||||
FullScreenWindow = this;
|
FullScreenWindow = this;
|
||||||
req_properties.clear_fullscreen();
|
req_properties.clear_fullscreen();
|
||||||
@ -1069,21 +1148,10 @@ bool osxGraphicsWindow::OSOpenWindow(WindowProperties &req_properties)
|
|||||||
|
|
||||||
if (req_properties.has_parent_window())
|
if (req_properties.has_parent_window())
|
||||||
{
|
{
|
||||||
NSWindow* parentWindow = (NSWindow *)req_properties.get_parent_window();
|
|
||||||
NSView* aView = [[parentWindow contentView] viewWithTag:378];
|
|
||||||
NSRect aRect = [aView frame];
|
|
||||||
NSPoint origin = [parentWindow convertBaseToScreen:aRect.origin];
|
|
||||||
|
|
||||||
osxdisplay_cat.info() << "Creating child window\n";
|
osxdisplay_cat.info() << "Creating child window\n";
|
||||||
|
|
||||||
CreateNewWindow(kSimpleWindowClass, kWindowNoAttributes, &r, &_osx_window);
|
CreateNewWindow(kSimpleWindowClass, kWindowNoAttributes, &r, &_osx_window);
|
||||||
NSWindow* childWindow = [[NSWindow alloc] initWithWindowRef:_osx_window];
|
AddAWindow(_osx_window);
|
||||||
|
|
||||||
[childWindow setFrameOrigin:origin];
|
|
||||||
[childWindow setAcceptsMouseMovedEvents:YES];
|
|
||||||
[childWindow setBackgroundColor:[NSColor blackColor]];
|
|
||||||
[parentWindow addChildWindow:childWindow ordered:NSWindowAbove];
|
|
||||||
[childWindow orderFront:nil];
|
|
||||||
|
|
||||||
_properties.set_fixed_size(true);
|
_properties.set_fixed_size(true);
|
||||||
osxdisplay_cat.info() << "Child window created\n";
|
osxdisplay_cat.info() << "Child window created\n";
|
||||||
@ -1112,12 +1180,14 @@ bool osxGraphicsWindow::OSOpenWindow(WindowProperties &req_properties)
|
|||||||
|
|
||||||
osxdisplay_cat.info() << "Creating standard window\n";
|
osxdisplay_cat.info() << "Creating standard window\n";
|
||||||
CreateNewWindow(kDocumentWindowClass, kWindowStandardDocumentAttributes | kWindowStandardHandlerAttribute, &r, &_osx_window);
|
CreateNewWindow(kDocumentWindowClass, kWindowStandardDocumentAttributes | kWindowStandardHandlerAttribute, &r, &_osx_window);
|
||||||
|
AddAWindow(_osx_window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (_osx_window)
|
if (_osx_window)
|
||||||
{
|
{
|
||||||
|
|
||||||
EventHandlerUPP gWinEvtHandler; // window event handler
|
EventHandlerUPP gWinEvtHandler; // window event handler
|
||||||
EventTypeSpec list[] =
|
EventTypeSpec list[] =
|
||||||
{
|
{
|
||||||
@ -1137,7 +1207,36 @@ bool osxGraphicsWindow::OSOpenWindow(WindowProperties &req_properties)
|
|||||||
SetWRefCon (_osx_window, (long) this); // point to the window record in the ref con of the window
|
SetWRefCon (_osx_window, (long) this); // point to the window record in the ref con of the window
|
||||||
gWinEvtHandler = NewEventHandlerUPP(windowEvtHndlr);
|
gWinEvtHandler = NewEventHandlerUPP(windowEvtHndlr);
|
||||||
InstallWindowEventHandler(_osx_window, gWinEvtHandler, GetEventTypeCount(list), list, (void*)this, NULL); // add event handler
|
InstallWindowEventHandler(_osx_window, gWinEvtHandler, GetEventTypeCount(list), list, (void*)this, NULL); // add event handler
|
||||||
|
|
||||||
|
if(!req_properties.has_parent_window())
|
||||||
|
{
|
||||||
ShowWindow (_osx_window);
|
ShowWindow (_osx_window);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
NSWindow* parentWindow = (NSWindow *)req_properties.get_parent_window();
|
||||||
|
// NSView* aView = [[parentWindow contentView] viewWithTag:378];
|
||||||
|
// NSRect aRect = [aView frame];
|
||||||
|
// NSPoint origin = [parentWindow convertBaseToScreen:aRect.origin];
|
||||||
|
|
||||||
|
// NSWindow* childWindow = [[NSWindow alloc] initWithWindowRef:_osx_window];
|
||||||
|
|
||||||
|
|
||||||
|
Post_Event_Wiait(PANDA_CREATE_WINDOW,(unsigned long) _osx_window,1,[parentWindow windowNumber]);
|
||||||
|
|
||||||
|
// [childWindow setFrameOrigin:origin];
|
||||||
|
// [childWindow setAcceptsMouseMovedEvents:YES];
|
||||||
|
// [childWindow setBackgroundColor:[NSColor blackColor]];
|
||||||
|
// this seems to block till the parent accepts the connection ?
|
||||||
|
// [parentWindow addChildWindow:childWindow ordered:NSWindowAbove];
|
||||||
|
// [childWindow orderFront:nil];
|
||||||
|
|
||||||
|
|
||||||
|
_properties.set_parent_window(req_properties.get_parent_window());
|
||||||
|
req_properties.clear_parent_window();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
osxdisplay_cat.info() << "Event handler installed, now buildGL\n";
|
osxdisplay_cat.info() << "Event handler installed, now buildGL\n";
|
||||||
if(buildGL(false) != noErr)
|
if(buildGL(false) != noErr)
|
||||||
@ -1191,6 +1290,7 @@ bool osxGraphicsWindow::OSOpenWindow(WindowProperties &req_properties)
|
|||||||
if (_properties.has_size())
|
if (_properties.has_size())
|
||||||
set_size_and_recalc(_properties.get_x_size(), _properties.get_y_size());
|
set_size_and_recalc(_properties.get_x_size(), _properties.get_y_size());
|
||||||
|
|
||||||
|
|
||||||
return (err == noErr);
|
return (err == noErr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1205,7 +1305,8 @@ void osxGraphicsWindow::process_events()
|
|||||||
{
|
{
|
||||||
GraphicsWindow::process_events();
|
GraphicsWindow::process_events();
|
||||||
|
|
||||||
if (!osx_disable_event_loop)
|
//if (!osx_disable_event_loop)
|
||||||
|
if (!_properties.has_parent_window())
|
||||||
{
|
{
|
||||||
EventRef theEvent;
|
EventRef theEvent;
|
||||||
EventTargetRef theTarget = GetEventDispatcherTarget();
|
EventTargetRef theTarget = GetEventDispatcherTarget();
|
||||||
@ -1230,6 +1331,8 @@ void osxGraphicsWindow::process_events()
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// key input handler
|
// key input handler
|
||||||
OSStatus osxGraphicsWindow::handleKeyInput (EventHandlerCallRef myHandler, EventRef event, Boolean keyDown) {
|
OSStatus osxGraphicsWindow::handleKeyInput (EventHandlerCallRef myHandler, EventRef event, Boolean keyDown) {
|
||||||
|
|
||||||
|
|
||||||
if (osxdisplay_cat.is_debug()) {
|
if (osxdisplay_cat.is_debug()) {
|
||||||
UInt32 keyCode;
|
UInt32 keyCode;
|
||||||
GetEventParameter (event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode);
|
GetEventParameter (event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode);
|
||||||
@ -1240,7 +1343,7 @@ OSStatus osxGraphicsWindow::handleKeyInput (EventHandlerCallRef myHandler, Event
|
|||||||
<< ", " << (int)keyDown << "\n";
|
<< ", " << (int)keyDown << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
CallNextEventHandler(myHandler, event);
|
//CallNextEventHandler(myHandler, event);
|
||||||
|
|
||||||
// We don't check the result of the above function. In principle,
|
// We don't check the result of the above function. In principle,
|
||||||
// this should return eventNotHandledErr if the key event is not
|
// this should return eventNotHandledErr if the key event is not
|
||||||
@ -1269,15 +1372,14 @@ OSStatus osxGraphicsWindow::handleKeyInput (EventHandlerCallRef myHandler, Event
|
|||||||
user_close_request();
|
user_close_request();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SendKeyEvent(button, true);
|
SendKeyEvent(button, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SendKeyEvent(button, false);
|
SendKeyEvent(button, false);
|
||||||
}
|
}
|
||||||
|
return CallNextEventHandler(myHandler, event);
|
||||||
return noErr;
|
// return noErr;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -1336,17 +1438,19 @@ void osxGraphicsWindow::SystemPointToLocalPoint(Point &qdGlobalPoint)
|
|||||||
GetEventParameter(event, kEventParamWindowRef, typeWindowRef, NULL, sizeof(WindowRef), NULL, &window);
|
GetEventParameter(event, kEventParamWindowRef, typeWindowRef, NULL, sizeof(WindowRef), NULL, &window);
|
||||||
|
|
||||||
if(!_is_fullscreen && (window == NULL || window != _osx_window )) {
|
if(!_is_fullscreen && (window == NULL || window != _osx_window )) {
|
||||||
if (kind == kEventMouseMoved) {
|
if (kind == kEventMouseMoved)
|
||||||
|
{
|
||||||
set_pointer_out_of_window();
|
set_pointer_out_of_window();
|
||||||
}
|
}
|
||||||
return eventNotHandledErr;
|
return eventNotHandledErr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GetWindowPortBounds (window, &rectPort);
|
GetWindowPortBounds (window, &rectPort);
|
||||||
|
|
||||||
result = CallNextEventHandler(myHandler, event);
|
// result = CallNextEventHandler(myHandler, event);
|
||||||
if (eventNotHandledErr == result)
|
// if (eventNotHandledErr == result)
|
||||||
{ // only handle events not already handled (prevents wierd resize interaction)
|
{ // only handle events not already handled (prevents wierd resize interaction)
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
// Whenever mouse button state changes, generate the
|
// Whenever mouse button state changes, generate the
|
||||||
@ -1433,7 +1537,6 @@ void osxGraphicsWindow::SystemPointToLocalPoint(Point &qdGlobalPoint)
|
|||||||
// result = noErr;
|
// result = noErr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// cerr <<" End Mouse Event \n";
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user