summaryrefslogtreecommitdiff
path: root/src/drivers/X11/Fl_X11_Window_Driver.cxx
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-05-27 13:36:29 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-05-27 13:36:29 +0200
commit7c4239915f818ff26309ed6a638871ea284a82e9 (patch)
treed842df48425e00e7b0d3a621363f1ba03376937d /src/drivers/X11/Fl_X11_Window_Driver.cxx
parent2cbc743c6ad32c09c4dca68ab36a0f24307df0bf (diff)
Fix Fl_X11_Window_Driver::capture_titlebar_and_borders() for scaled, partially visible windows
Diffstat (limited to 'src/drivers/X11/Fl_X11_Window_Driver.cxx')
-rw-r--r--src/drivers/X11/Fl_X11_Window_Driver.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx
index 34313ce26..e2ed5d073 100644
--- a/src/drivers/X11/Fl_X11_Window_Driver.cxx
+++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx
@@ -391,14 +391,17 @@ void Fl_X11_Window_Driver::free_icons() {
The top and bottom images extend from left of the left border to right of the right border.
This function exploits a feature of Fl_X11_Screen_Driver::read_win_rectangle() which,
- when called with negative 4th argument, captures the window decoration.
+ when called with negative 3rd argument, captures the window decoration.
+ Other requirements to capture the window decoration:
+ - fl_window is the parent window of the top window
+ - Fl_Window::current() is the top window
*/
void Fl_X11_Window_Driver::capture_titlebar_and_borders(Fl_RGB_Image*& top, Fl_RGB_Image*& left, Fl_RGB_Image*& bottom, Fl_RGB_Image*& right)
{
top = left = bottom = right = NULL;
if (pWindow->decorated_h() == h()) return;
Window from = fl_window;
- Fl_Surface_Device::push_current( Fl_Display_Device::display_device() );
+ Fl_Window *oldcurrent = Fl_Window::current();
Window root, parent, *children, child_win, xid = fl_xid(pWindow);
unsigned n = 0;
int do_it;
@@ -411,9 +414,10 @@ void Fl_X11_Window_Driver::capture_titlebar_and_borders(Fl_RGB_Image*& top, Fl_R
float s = Fl::screen_driver()->scale(screen_num());
htop /= s; wsides /= s;
fl_window = parent;
+ current(pWindow);
if (htop) {
top = Fl::screen_driver()->read_win_rectangle(0, 0, - (w() + 2 * wsides), htop);
- top->scale(w() + 2 * wsides, htop, 0, 1);
+ if (top) top->scale(w() + 2 * wsides, htop, 0, 1);
}
if (wsides) {
left = Fl::screen_driver()->read_win_rectangle(0, htop, -wsides, h());
@@ -428,7 +432,7 @@ void Fl_X11_Window_Driver::capture_titlebar_and_borders(Fl_RGB_Image*& top, Fl_R
if (bottom) {
bottom->scale(w() + 2*wsides, wsides, 0, 1);
} }
- Fl_Surface_Device::pop_current();
+ current(oldcurrent);
fl_window = from;
}