renamed get_event to get_llevent in X11
This commit is contained in:
parent
246662220f
commit
6a721bb62a
@ -7,7 +7,6 @@ class X11(Object) from 'x11'
|
|||||||
## definition struct x11_t defined in _x11.h
|
## definition struct x11_t defined in _x11.h
|
||||||
## ---------------------------------------------------------------------
|
## ---------------------------------------------------------------------
|
||||||
var display_base := nil.
|
var display_base := nil.
|
||||||
var llevent.
|
|
||||||
var expose_event.
|
var expose_event.
|
||||||
var key_event.
|
var key_event.
|
||||||
var mouse_event.
|
var mouse_event.
|
||||||
@ -23,7 +22,7 @@ class X11(Object) from 'x11'
|
|||||||
method(#primitive,#liberal) _open_display(name).
|
method(#primitive,#liberal) _open_display(name).
|
||||||
method(#primitive) _close_display.
|
method(#primitive) _close_display.
|
||||||
method(#primitive) _get_fd.
|
method(#primitive) _get_fd.
|
||||||
method(#primitive) _get_event.
|
method(#primitive) _get_llevent(llevent).
|
||||||
|
|
||||||
method(#primitive) _create_window(parent_window, x, y, width, height, fgcolor, bgcolor).
|
method(#primitive) _create_window(parent_window, x, y, width, height, fgcolor, bgcolor).
|
||||||
method(#primitive) _destroy_window(window).
|
method(#primitive) _destroy_window(window).
|
||||||
@ -404,7 +403,6 @@ extend X11
|
|||||||
{
|
{
|
||||||
super initialize.
|
super initialize.
|
||||||
|
|
||||||
self.llevent := self.LLEvent new.
|
|
||||||
self.expose_event := self.ExposeEvent new.
|
self.expose_event := self.ExposeEvent new.
|
||||||
self.key_event := self.KeyEvent new.
|
self.key_event := self.KeyEvent new.
|
||||||
self.mouse_event := self.MouseEvent new.
|
self.mouse_event := self.MouseEvent new.
|
||||||
@ -471,8 +469,9 @@ extend X11
|
|||||||
self.event_loop_sem := Semaphore new.
|
self.event_loop_sem := Semaphore new.
|
||||||
Processor signal: self.event_loop_sem onInput: (self _get_fd).
|
Processor signal: self.event_loop_sem onInput: (self _get_fd).
|
||||||
self.event_loop_proc := [
|
self.event_loop_proc := [
|
||||||
| evtbuf event ongoing |
|
| llevtbuf llevent ongoing |
|
||||||
|
|
||||||
|
llevtbuf := X11.LLEvent new.
|
||||||
ongoing := true.
|
ongoing := true.
|
||||||
while (self.shell_container childrenCount > 0)
|
while (self.shell_container childrenCount > 0)
|
||||||
{
|
{
|
||||||
@ -480,9 +479,9 @@ extend X11
|
|||||||
self.event_loop_sem wait.
|
self.event_loop_sem wait.
|
||||||
if (ongoing not) { break }.
|
if (ongoing not) { break }.
|
||||||
|
|
||||||
while ((event := self _get_event) notNil)
|
while ((llevent := self _get_llevent(llevtbuf)) notNil)
|
||||||
{
|
{
|
||||||
if (event isError)
|
if (llevent isError)
|
||||||
{
|
{
|
||||||
##System logNl: ('Error while getting a event from server ' & self.cid asString).
|
##System logNl: ('Error while getting a event from server ' & self.cid asString).
|
||||||
ongoing := false.
|
ongoing := false.
|
||||||
@ -490,7 +489,7 @@ extend X11
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
self __dispatch_event: event.
|
self __dispatch_llevent: llevent.
|
||||||
}.
|
}.
|
||||||
}.
|
}.
|
||||||
}.
|
}.
|
||||||
@ -519,26 +518,26 @@ extend X11
|
|||||||
self.event_loop_sem signal.
|
self.event_loop_sem signal.
|
||||||
}
|
}
|
||||||
|
|
||||||
method __dispatch_event: event
|
method __dispatch_llevent: llevent
|
||||||
{
|
{
|
||||||
(*
|
| widget mthname |
|
||||||
| type mthname |
|
|
||||||
|
|
||||||
|
widget := self.window_registrar at: llevent window.
|
||||||
|
if (widget isError)
|
||||||
|
{
|
||||||
|
System logNl: 'Event on unknown widget - ' & (llevent window asString).
|
||||||
|
^nil
|
||||||
|
}.
|
||||||
|
|
||||||
##type := System _getUint8(event, 0).
|
mthname := self.llevent_blocks at: llevent type.
|
||||||
type := event getUint8(0).
|
|
||||||
|
|
||||||
mthname := self.llevent_blocks at: (type bitAnd: 16r7F).
|
|
||||||
if (mthname isError)
|
if (mthname isError)
|
||||||
{
|
{
|
||||||
('IGNORING UNKNOWN LL-EVENT TYPE ' & type asString) dump.
|
System logNl: 'Uknown event type ' & (llevent type asString).
|
||||||
}
|
^nil
|
||||||
else
|
}.
|
||||||
{
|
|
||||||
^self perform (mthname, event).
|
(llevent window asString) dump.
|
||||||
##^self perform: mthname with: event.
|
^self perform (mthname, llevent).
|
||||||
}
|
|
||||||
*)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
method __handle_notify: type
|
method __handle_notify: type
|
||||||
|
@ -60,7 +60,7 @@ struct x11_t
|
|||||||
MOO_OBJ_HEADER;
|
MOO_OBJ_HEADER;
|
||||||
|
|
||||||
moo_oop_t display; /* SMPTR of Display */
|
moo_oop_t display; /* SMPTR of Display */
|
||||||
oop_x11_llevent_t llevent;
|
moo_oop_t expose_event;
|
||||||
moo_oop_t key_event;
|
moo_oop_t key_event;
|
||||||
moo_oop_t mouse_event;
|
moo_oop_t mouse_event;
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ static moo_pfrc_t pf_get_fd (moo_t* moo, moo_ooi_t nargs)
|
|||||||
return MOO_PF_SUCCESS;
|
return MOO_PF_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static moo_pfrc_t pf_get_event (moo_t* moo, moo_ooi_t nargs)
|
static moo_pfrc_t pf_get_llevent (moo_t* moo, moo_ooi_t nargs)
|
||||||
{
|
{
|
||||||
oop_x11_t x11;
|
oop_x11_t x11;
|
||||||
x11_trailer_t* tr;
|
x11_trailer_t* tr;
|
||||||
@ -175,13 +175,14 @@ static moo_pfrc_t pf_get_event (moo_t* moo, moo_ooi_t nargs)
|
|||||||
|
|
||||||
XNextEvent (disp, event);
|
XNextEvent (disp, event);
|
||||||
|
|
||||||
e = x11->llevent;
|
e = (oop_x11_llevent_t)MOO_STACK_GETARG(moo, nargs, 0);
|
||||||
|
/* TOOD: check if e is an instance of X11.LLEvent */
|
||||||
e->type = MOO_SMOOI_TO_OOP(event->type);
|
e->type = MOO_SMOOI_TO_OOP(event->type);
|
||||||
e->window = MOO_SMOOI_TO_OOP(0);
|
e->window = MOO_SMOOI_TO_OOP(0);
|
||||||
|
|
||||||
/* [NOTE] When creating the low-level event object, ensure not to
|
/* if the following is going to trigger GC directly or indirectly,
|
||||||
* trigger GC directly or indirectly as the GC might be a
|
* e must be proteced with moo_pushtmp() first */
|
||||||
* copying collector which move objects around during collection */
|
|
||||||
switch (event->type)
|
switch (event->type)
|
||||||
{
|
{
|
||||||
case ClientMessage:
|
case ClientMessage:
|
||||||
@ -203,6 +204,14 @@ static moo_pfrc_t pf_get_event (moo_t* moo, moo_ooi_t nargs)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case ButtonPress:
|
||||||
|
case ButtonRelease:
|
||||||
|
{
|
||||||
|
e->window = MOO_SMOOI_TO_OOP(event->xbutton.window);
|
||||||
|
e->x = MOO_SMOOI_TO_OOP(event->xbutton.x);
|
||||||
|
e->y = MOO_SMOOI_TO_OOP(event->xbutton.y);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MOO_STACK_SETRET (moo, nargs, (moo_oop_t)e);
|
MOO_STACK_SETRET (moo, nargs, (moo_oop_t)e);
|
||||||
@ -448,8 +457,8 @@ static moo_pfinfo_t x11_pfinfo[] =
|
|||||||
{ MI, { '_','d','e','s','t','r','o','y','_','w','i','n','d','o','w','\0' }, 0, { pf_destroy_window, 1, 1 } },
|
{ MI, { '_','d','e','s','t','r','o','y','_','w','i','n','d','o','w','\0' }, 0, { pf_destroy_window, 1, 1 } },
|
||||||
{ MI, { '_','d','r','a','w','_','r','e','c','t','a','n','g','l','e','\0' }, 0, { pf_draw_rectangle, 6, 6 } },
|
{ MI, { '_','d','r','a','w','_','r','e','c','t','a','n','g','l','e','\0' }, 0, { pf_draw_rectangle, 6, 6 } },
|
||||||
//{ MI, { '_','f','i','l','l','_','r','e','c','t','a','n','g','l','e','\0' }, 0, { pf_fill_rectangle, 6, 6 } },
|
//{ MI, { '_','f','i','l','l','_','r','e','c','t','a','n','g','l','e','\0' }, 0, { pf_fill_rectangle, 6, 6 } },
|
||||||
{ MI, { '_','g','e','t','_','e','v','e','n','t','\0'}, 0, { pf_get_event, 0, 0 } },
|
|
||||||
{ MI, { '_','g','e','t','_','f','d','\0' }, 0, { pf_get_fd, 0, 0 } },
|
{ MI, { '_','g','e','t','_','f','d','\0' }, 0, { pf_get_fd, 0, 0 } },
|
||||||
|
{ MI, { '_','g','e','t','_','l','l','e','v','e','n','t','\0'}, 0, { pf_get_llevent, 1, 1 } },
|
||||||
{ MI, { '_','o','p','e','n','_','d','i','s','p','l','a','y','\0' }, 0, { pf_open_display, 0, 1 } }
|
{ MI, { '_','o','p','e','n','_','d','i','s','p','l','a','y','\0' }, 0, { pf_open_display, 0, 1 } }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user