mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
[qwaq] Implement mouse grabbing
Button will need it for dragging.
This commit is contained in:
parent
2c20a031e4
commit
95d20d67c7
3 changed files with 8 additions and 5 deletions
|
@ -40,7 +40,7 @@ arp_end (void)
|
|||
initialize ();
|
||||
init_pair (1, COLOR_WHITE, COLOR_BLUE);
|
||||
init_pair (2, COLOR_WHITE, COLOR_BLACK);
|
||||
init_pair (3, COLOR_WHITE, COLOR_GREEN);
|
||||
init_pair (3, COLOR_BLACK, COLOR_GREEN);
|
||||
init_pair (4, COLOR_YELLOW, COLOR_RED);
|
||||
|
||||
screen = [TextContext screen];
|
||||
|
|
|
@ -38,13 +38,15 @@
|
|||
switch ((qwaq_mouse_event) (event.what & qe_mouse)) {
|
||||
case qe_mousedown:
|
||||
pressed = 1;
|
||||
[self redraw];
|
||||
action = onPress;
|
||||
[self grabMouse];
|
||||
[self redraw];
|
||||
break;
|
||||
case qe_mouseup:
|
||||
pressed = 0;
|
||||
[self redraw];
|
||||
action = onRelease;
|
||||
[self releaseMouse];
|
||||
[self redraw];
|
||||
break;
|
||||
case qe_mouseclick:
|
||||
action = onClick;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
-insert: (View *) view
|
||||
{
|
||||
[views addObject: view];
|
||||
[view setOwner: self];
|
||||
[view setContext: context];
|
||||
return self;
|
||||
}
|
||||
|
@ -135,8 +136,8 @@ find_mouse_view(Group *group, Point pos)
|
|||
|
||||
-(void) releaseMouse
|
||||
{
|
||||
mouse_grabbed = mouse_within;
|
||||
[owner grabMouse];
|
||||
mouse_grabbed = nil;
|
||||
[owner releaseMouse];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue