summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2018-06-21 18:14:13 +0000
committerMatthias Melcher <fltk@matthiasm.com>2018-06-21 18:14:13 +0000
commit7617a46b26559bf9f78b23061e92ba82f4bfc6fa (patch)
tree92d822961b4f314f5f7c4ab3a055e9e383373a80 /src
parent448cf7785524ac23edcee46f52e1b1bf4266a39c (diff)
Android: roughly fixed Fl::grab() to make menus easier to navigate
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12960 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/drivers/Android/Fl_Android_Screen_Driver.H20
-rw-r--r--src/drivers/Android/Fl_Android_Screen_Driver.cxx24
2 files changed, 34 insertions, 10 deletions
diff --git a/src/drivers/Android/Fl_Android_Screen_Driver.H b/src/drivers/Android/Fl_Android_Screen_Driver.H
index 714be5fd2..87b4faae7 100644
--- a/src/drivers/Android/Fl_Android_Screen_Driver.H
+++ b/src/drivers/Android/Fl_Android_Screen_Driver.H
@@ -101,15 +101,19 @@ public:
virtual int visual(int flags);
// --- screen configuration
virtual void init();
- virtual int x();
- virtual int y();
- virtual int w();
- virtual int h();
- virtual void screen_xywh(int &X, int &Y, int &W, int &H, int n);
+#endif
+ virtual int x() override { return 0; } // FIXME:
+ virtual int y() override { return 0; } // FIXME:
+ virtual int w() override { return 600; } // FIXME:
+ virtual int h() override { return 800; } // FIXME:
+ virtual void screen_xywh(int &X, int &Y, int &W, int &H, int n) override
+ { X = 0; Y = 0; W = 600; H = 800; } // FIXME:
+#if 0
virtual void screen_dpi(float &h, float &v, int n=0);
int screen_num_unscaled(int x, int y);
- virtual void screen_work_area(int &X, int &Y, int &W, int &H, int n);
#endif
+ virtual void screen_work_area(int &X, int &Y, int &W, int &H, int n) override
+ { X = 0; Y = 0; W = 600; H = 800; } // FIXME:
// --- audible output
virtual void beep(int type) override;
// --- global events
@@ -117,7 +121,9 @@ public:
virtual double wait(double time_to_wait) override;
#if 0
virtual int ready();
- virtual void grab(Fl_Window* win);
+#endif
+ virtual void grab(Fl_Window* win) override;
+#if 0
// --- global colors
virtual void get_system_colors();
virtual const char *get_system_scheme();
diff --git a/src/drivers/Android/Fl_Android_Screen_Driver.cxx b/src/drivers/Android/Fl_Android_Screen_Driver.cxx
index 4a9674a2b..a7476c94e 100644
--- a/src/drivers/Android/Fl_Android_Screen_Driver.cxx
+++ b/src/drivers/Android/Fl_Android_Screen_Driver.cxx
@@ -147,15 +147,17 @@ int Fl_Android_Screen_Driver::handle_mouse_event(AInputQueue *queue, AInputEvent
if (AMotionEvent_getAction(event) == AMOTION_EVENT_ACTION_DOWN) {
AInputQueue_finishEvent(queue, event, 1);
Fl::e_is_click = 1;
+ Fl_Android_Application::log_i("Mouse push %x %d at %d, %d", win, Fl::event_button(), Fl::event_x(), Fl::event_y());
if (win) Fl::handle(FL_PUSH, win); // do NOT send a push event into the "Desktop"
- Fl_Android_Application::log_i("Mouse push %d at %d, %d", Fl::event_button(), Fl::event_x(), Fl::event_y());
} else if (AMotionEvent_getAction(event) == AMOTION_EVENT_ACTION_MOVE) {
AInputQueue_finishEvent(queue, event, 1);
- Fl::handle(FL_DRAG, win);
+ Fl_Android_Application::log_i("Mouse drag %x %d at %d, %d", win, Fl::event_button(), Fl::event_x(), Fl::event_y());
+ if (win) Fl::handle(FL_DRAG, win);
} else if (AMotionEvent_getAction(event) == AMOTION_EVENT_ACTION_UP) {
AInputQueue_finishEvent(queue, event, 1);
Fl::e_state = 0;
- Fl::handle(FL_RELEASE, win);
+ Fl_Android_Application::log_i("Mouse release %x %d at %d, %d", win, Fl::event_button(), Fl::event_x(), Fl::event_y());
+ if (win) Fl::handle(FL_RELEASE, win);
} else {
AInputQueue_finishEvent(queue, event, 0);
}
@@ -504,6 +506,22 @@ int Fl_Android_Screen_Driver::get_mouse(int &x, int &y)
return 1;
}
+
+void Fl_Android_Screen_Driver::grab(Fl_Window* win)
+{
+ if (win) {
+ if (!Fl::grab_) {
+ // TODO: will we need to fix any focus and/or direct the input stream to a window
+ }
+ Fl::grab_ = win;
+ } else {
+ if (Fl::grab_) {
+ Fl::grab_ = 0;
+ }
+ }
+}
+
+
//
// End of "$Id$".
//