diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2018-06-21 17:02:47 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2018-06-21 17:02:47 +0000 |
| commit | 333e718ae735411fec220334256360b8e3b4b1bb (patch) | |
| tree | e3d5a504565f1f2bdd461e7e9c90ae454dc62a5f /src/drivers/Android/Fl_Android_Window_Driver.cxx | |
| parent | 22c21fa8401b6e433611258a703a0d7eda64584a (diff) | |
Android: Windows are now centered on screen if no position is defined, dialogs pop up in a more logical position.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12958 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/Android/Fl_Android_Window_Driver.cxx')
| -rw-r--r-- | src/drivers/Android/Fl_Android_Window_Driver.cxx | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/drivers/Android/Fl_Android_Window_Driver.cxx b/src/drivers/Android/Fl_Android_Window_Driver.cxx index 7a06bc372..364e0b62f 100644 --- a/src/drivers/Android/Fl_Android_Window_Driver.cxx +++ b/src/drivers/Android/Fl_Android_Window_Driver.cxx @@ -49,12 +49,29 @@ void Fl_Android_Window_Driver::show() if (!shown()) { // make window fl_open_display(); + if (pWindow->parent() && !Fl_X::i(pWindow->window())) { + pWindow->set_visible(); + return; + } pWindow->set_visible(); Fl_X *x = new Fl_X; x->w = pWindow; i(x); x->next = Fl_X::first; Fl_X::first = x; + // position window + // TODO: we want to scale the screen to hold all windows + // TODO: we want to allow for screen size hints to make apps look perfect, even if the screen is rotated + if (force_position()) { + // TODO: make sure that we are on a screen if this is just a regular window + } else { + // Center any new window on screen + pWindow->position( + (600-pWindow->w())/2, + (800-pWindow->h())/2 + ); + } + // show window or defer showing window if (Fl_Android_Application::native_window()) { pWindow->redraw(); } else { @@ -62,7 +79,8 @@ void Fl_Android_Window_Driver::show() } } else { // bring window to front - Fl::first_window(pWindow); // TODO: does this really work? + if (!pWindow->parent()) + Fl::first_window(pWindow); // TODO: does this really work? expose_all(); } } |
