summaryrefslogtreecommitdiff
path: root/src/drivers/Android/Fl_Android_Graphics_Driver.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2018-06-19 16:29:20 +0000
committerMatthias Melcher <fltk@matthiasm.com>2018-06-19 16:29:20 +0000
commite1bf7b920254deea542c9c09a344498982ba9424 (patch)
tree7201753805136c2db4d903bf4cbca159f3927840 /src/drivers/Android/Fl_Android_Graphics_Driver.cxx
parentba58edb33c3e8665cb872548270ee4e98c4ec150 (diff)
Android: Clearing the desktop when a window is hidden.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12949 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/Android/Fl_Android_Graphics_Driver.cxx')
-rw-r--r--src/drivers/Android/Fl_Android_Graphics_Driver.cxx20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/drivers/Android/Fl_Android_Graphics_Driver.cxx b/src/drivers/Android/Fl_Android_Graphics_Driver.cxx
index 06cc3b441..b927d1aa2 100644
--- a/src/drivers/Android/Fl_Android_Graphics_Driver.cxx
+++ b/src/drivers/Android/Fl_Android_Graphics_Driver.cxx
@@ -57,25 +57,35 @@ Fl_Android_Graphics_Driver::~Fl_Android_Graphics_Driver()
void Fl_Android_Graphics_Driver::make_current(Fl_Window *win)
{
+ // In the special case of win==0, we activate the desktop (the screen
+ // background) for drawing and clip out all visible windows
+
// The Stride is the offset between lines in the graphics buffer
pStride = Fl_Android_Application::graphics_buffer().stride;
// Bits is the memory address of the top left corner of the window
- pBits = ((uint16_t*)(Fl_Android_Application::graphics_buffer().bits))
- + win->x_root() + pStride * win->y_root();
+ pBits = ((uint16_t*)(Fl_Android_Application::graphics_buffer().bits));
+ if (win) pBits += win->x_root() + pStride * win->y_root();
// TODO: set the clipping area
// set the clipping area to the physical screen size in window coordinates
- pWindowRegion.set(-win->x(), -win->y(), 600, 800);
- pWindowRegion.intersect_with(Fl_Rect_Region(0, 0, win->w(), win->h()));
+ if (win) {
+ pWindowRegion.set(-win->x(), -win->y(), 600, 800);
+ pWindowRegion.intersect_with(Fl_Rect_Region(0, 0, win->w(), win->h()));
+ } else {
+ pWindowRegion.set(0, 0, 600, 800);
+ }
pDesktopWindowRegion.set(pWindowRegion);
// remove all window rectangles that are positioned on top of this window
// TODO: this region is expensive to calculate. Cache it for each window and recalculate when windows move, show, hide, or change order
+ // TODO: this is where we also need to subtract any possible window decoration, like the window title and drag bar, resizing edges, etc.
Fl_Window *wTop = Fl::first_window();
+ int wx = win ? win->x() : 0;
+ int wy = win ? win->y() : 0;
while (wTop) {
if (wTop==win) break;
- Fl_Rect_Region r(wTop->x()-win->x(), wTop->y()-win->y(), wTop->w(), wTop->h());
+ Fl_Rect_Region r(wTop->x()-wx, wTop->y()-wy, wTop->w(), wTop->h());
pDesktopWindowRegion.subtract(r);
wTop = Fl::next_window(wTop);
}