Display mouse button state in test/handle_events.cxx demo
See fltk.general, thread "Is handling simultaneous Left-click and Right-click drags supported?" from Jul 12, 2023 Status: FL_DRAG operation is terminated when one mouse button is released, even if more than one button is actually down. Subsequent mouse movement is reported as FL_MOVE rather than FL_DRAG, this is under investigation.
This commit is contained in:
parent
44840af076
commit
03913f32e0
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Event test program for the Fast Light Tool Kit (FLTK).
|
// Event test program for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
// Copyright 1998-2021 by Bill Spitzak and others.
|
// Copyright 1998-2023 by Bill Spitzak and others.
|
||||||
//
|
//
|
||||||
// This library is free software. Distribution and use rights are outlined in
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
// the file "COPYING" which should have been included with this file. If this
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
@ -14,7 +14,7 @@
|
|||||||
// https://www.fltk.org/bugs.php
|
// https://www.fltk.org/bugs.php
|
||||||
//
|
//
|
||||||
|
|
||||||
// compile standalone as: fltk-config --compile handle_events.cxx
|
// Build: fltk-config --compile handle_events.cxx
|
||||||
|
|
||||||
#include <FL/Fl.H>
|
#include <FL/Fl.H>
|
||||||
#include <FL/Fl_Double_Window.H>
|
#include <FL/Fl_Double_Window.H>
|
||||||
@ -62,13 +62,14 @@ public:
|
|||||||
int app::handle(int ev) {
|
int app::handle(int ev) {
|
||||||
print_event(ev); // common for all events
|
print_event(ev); // common for all events
|
||||||
int res = WINDOW_TYPE::handle(ev);
|
int res = WINDOW_TYPE::handle(ev);
|
||||||
|
int buttons = Fl::event_buttons() >> 24; // bits: 1=left, 2=middle, 4=right button
|
||||||
switch (ev) {
|
switch (ev) {
|
||||||
case FL_PUSH:
|
case FL_PUSH:
|
||||||
fprintf(stderr, ", button %d down", Fl::event_button());
|
fprintf(stderr, ", button %d down, buttons = 0x%x", Fl::event_button(), buttons);
|
||||||
res = 1;
|
res = 1;
|
||||||
break;
|
break;
|
||||||
case FL_RELEASE:
|
case FL_RELEASE:
|
||||||
fprintf(stderr, ", button %d up", Fl::event_button());
|
fprintf(stderr, ", button %d up, buttons = 0x%x", Fl::event_button(), buttons);
|
||||||
res = 1;
|
res = 1;
|
||||||
break;
|
break;
|
||||||
case FL_MOUSEWHEEL:
|
case FL_MOUSEWHEEL:
|
||||||
@ -77,8 +78,11 @@ int app::handle(int ev) {
|
|||||||
break;
|
break;
|
||||||
case FL_ENTER:
|
case FL_ENTER:
|
||||||
case FL_LEAVE:
|
case FL_LEAVE:
|
||||||
|
res = 1;
|
||||||
|
break;
|
||||||
case FL_MOVE:
|
case FL_MOVE:
|
||||||
case FL_DRAG:
|
case FL_DRAG:
|
||||||
|
fprintf(stderr, ", mouse buttons = 0x%x", buttons);
|
||||||
res = 1;
|
res = 1;
|
||||||
break;
|
break;
|
||||||
case FL_KEYBOARD:
|
case FL_KEYBOARD:
|
||||||
|
Loading…
Reference in New Issue
Block a user