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 ();
|
initialize ();
|
||||||
init_pair (1, COLOR_WHITE, COLOR_BLUE);
|
init_pair (1, COLOR_WHITE, COLOR_BLUE);
|
||||||
init_pair (2, COLOR_WHITE, COLOR_BLACK);
|
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);
|
init_pair (4, COLOR_YELLOW, COLOR_RED);
|
||||||
|
|
||||||
screen = [TextContext screen];
|
screen = [TextContext screen];
|
||||||
|
|
|
@ -38,13 +38,15 @@
|
||||||
switch ((qwaq_mouse_event) (event.what & qe_mouse)) {
|
switch ((qwaq_mouse_event) (event.what & qe_mouse)) {
|
||||||
case qe_mousedown:
|
case qe_mousedown:
|
||||||
pressed = 1;
|
pressed = 1;
|
||||||
[self redraw];
|
|
||||||
action = onPress;
|
action = onPress;
|
||||||
|
[self grabMouse];
|
||||||
|
[self redraw];
|
||||||
break;
|
break;
|
||||||
case qe_mouseup:
|
case qe_mouseup:
|
||||||
pressed = 0;
|
pressed = 0;
|
||||||
[self redraw];
|
|
||||||
action = onRelease;
|
action = onRelease;
|
||||||
|
[self releaseMouse];
|
||||||
|
[self redraw];
|
||||||
break;
|
break;
|
||||||
case qe_mouseclick:
|
case qe_mouseclick:
|
||||||
action = onClick;
|
action = onClick;
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
-insert: (View *) view
|
-insert: (View *) view
|
||||||
{
|
{
|
||||||
[views addObject: view];
|
[views addObject: view];
|
||||||
|
[view setOwner: self];
|
||||||
[view setContext: context];
|
[view setContext: context];
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -135,8 +136,8 @@ find_mouse_view(Group *group, Point pos)
|
||||||
|
|
||||||
-(void) releaseMouse
|
-(void) releaseMouse
|
||||||
{
|
{
|
||||||
mouse_grabbed = mouse_within;
|
mouse_grabbed = nil;
|
||||||
[owner grabMouse];
|
[owner releaseMouse];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in a new issue