Break off -processEvent: from -receivedEvent:type:extra:forMode:

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@18056 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2003-11-05 18:39:20 +00:00
parent 186159864d
commit 0ec00d1093
2 changed files with 35 additions and 14 deletions

View file

@ -1,3 +1,8 @@
2003-11-05 Adam Fedor <fedor@gnu.org>
* Source/x11/XGServerEvent.m ([XGServer -processEvent:]): New
method broken off from -receivedEvent:type:extra:forMode:.
2003-11-05 03:29 Alexander Malmberg <alexander@malmberg.org> 2003-11-05 03:29 Alexander Malmberg <alexander@malmberg.org>
* Source/x11/XGServerEvent.m (-receivedEvent:type:extra:forMode:): * Source/x11/XGServerEvent.m (-receivedEvent:type:extra:forMode:):

View file

@ -83,6 +83,8 @@ void __objc_xgcontextevent_linking (void)
{ {
} }
static SEL procSel = 0;
static void (*procEvent)(id, SEL, XEvent*) = 0;
@interface XGServer (Private) @interface XGServer (Private)
- (void) receivedEvent: (void*)data - (void) receivedEvent: (void*)data
@ -94,6 +96,7 @@ void __objc_xgcontextevent_linking (void)
type: (RunLoopEventType)type type: (RunLoopEventType)type
forMode: (NSString*)mode; forMode: (NSString*)mode;
- (int) XGErrorHandler: (Display*)display : (XErrorEvent*)err; - (int) XGErrorHandler: (Display*)display : (XErrorEvent*)err;
- (void) processEvent: (XEvent *) event;
@end @end
@ -209,6 +212,12 @@ static inline int check_modifier (XEvent *xEvent, KeyCode key_code)
watcher: (id<RunLoopEvents>)self watcher: (id<RunLoopEvents>)self
forMode: mode]; forMode: mode];
#endif #endif
if (procSel == 0)
{
procSel = @selector(processEvent:);
procEvent = (void (*)(id, SEL, XEvent*))
[self methodForSelector: procSel];
}
} }
#if LIB_FOUNDATION_LIBRARY #if LIB_FOUNDATION_LIBRARY
@ -234,20 +243,7 @@ static inline int check_modifier (XEvent *xEvent, KeyCode key_code)
extra: (void*)extra extra: (void*)extra
forMode: (NSString*)mode forMode: (NSString*)mode
{ {
static int clickCount = 1;
static unsigned int eventFlags;
NSEvent *e = nil;
XEvent xEvent; XEvent xEvent;
static NSPoint eventLocation;
NSWindow *nswin;
Window xWin;
NSEventType eventType;
NSGraphicsContext *gcontext;
float deltaX;
float deltaY;
/* FIXME: How do you guarentee a context is associated with an event? */
gcontext = GSCurrentContext();
// loop and grab all of the events from the X queue // loop and grab all of the events from the X queue
while (XPending(dpy) > 0) while (XPending(dpy) > 0)
@ -262,6 +258,27 @@ static inline int check_modifier (XEvent *xEvent, KeyCode key_code)
} }
#endif #endif
(*procEvent)(self, procSel, &xEvent);
}
}
- (void) processEvent: (XEvent *) event
{
static int clickCount = 1;
static unsigned int eventFlags;
NSEvent *e = nil;
XEvent xEvent;
static NSPoint eventLocation;
NSWindow *nswin;
Window xWin;
NSEventType eventType;
NSGraphicsContext *gcontext;
float deltaX;
float deltaY;
gcontext = GSCurrentContext();
xEvent = *event;
switch (xEvent.type) switch (xEvent.type)
{ {
// mouse button events // mouse button events
@ -1272,7 +1289,6 @@ static inline int check_modifier (XEvent *xEvent, KeyCode key_code)
if (e) if (e)
[event_queue addObject: e]; [event_queue addObject: e];
e = nil; e = nil;
}
} }
// Return the key_code corresponding to the user defaults string // Return the key_code corresponding to the user defaults string