summaryrefslogtreecommitdiff
path: root/src/drivers/X11
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2016-03-12 22:24:20 +0000
committerMatthias Melcher <fltk@matthiasm.com>2016-03-12 22:24:20 +0000
commite6631a0f7fdc8d3383927bac49f521791cddcc9c (patch)
treeb753578787e06c5aa2acea4c215063cb34167093 /src/drivers/X11
parent4643f3e98c8bfabc262770bca5afc31a8b38c7f5 (diff)
Moved the Fl_Window::decorated_*() functions teh Window_Driver
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11356 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/X11')
-rw-r--r--src/drivers/X11/Fl_X11_Window_Driver.H8
-rw-r--r--src/drivers/X11/Fl_X11_Window_Driver.cxx42
2 files changed, 50 insertions, 0 deletions
diff --git a/src/drivers/X11/Fl_X11_Window_Driver.H b/src/drivers/X11/Fl_X11_Window_Driver.H
index 3e4a80880..02c0de989 100644
--- a/src/drivers/X11/Fl_X11_Window_Driver.H
+++ b/src/drivers/X11/Fl_X11_Window_Driver.H
@@ -60,13 +60,21 @@ struct Fl_Window_Driver::shape_data_type {
class FL_EXPORT Fl_X11_Window_Driver : public Fl_Window_Driver
{
friend class Fl_X;
+
private:
+ void decorated_win_size(int &w, int &h);
void combine_mask();
void shape_bitmap_(Fl_Image* b);
void shape_alpha_(Fl_Image* img, int offset);
+
public:
Fl_X11_Window_Driver(Fl_Window*);
~Fl_X11_Window_Driver();
+
+ // --- window data
+ virtual int decorated_w();
+ virtual int decorated_h();
+
virtual void take_focus();
virtual void shape(const Fl_Image* img);
virtual void draw();
diff --git a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx
index 05c27a972..6ff2158c2 100644
--- a/src/drivers/X11/Fl_X11_Window_Driver.cxx
+++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx
@@ -72,6 +72,48 @@ Fl_X11_Window_Driver::~Fl_X11_Window_Driver()
delete icon_;
}
+
+// --- private
+
+void Fl_X11_Window_Driver::decorated_win_size(int &w, int &h)
+{
+ Fl_Window *win = pWindow;
+ w = win->w();
+ h = win->h();
+ if (!win->shown() || win->parent() || !win->border() || !win->visible()) return;
+ Window root, parent, *children;
+ unsigned n = 0;
+ Status status = XQueryTree(fl_display, Fl_X::i(win)->xid, &root, &parent, &children, &n);
+ if (status != 0 && n) XFree(children);
+ // when compiz is used, root and parent are the same window
+ // and I don't know where to find the window decoration
+ if (status == 0 || root == parent) return;
+ XWindowAttributes attributes;
+ XGetWindowAttributes(fl_display, parent, &attributes);
+ w = attributes.width;
+ h = attributes.height;
+}
+
+
+// --- window data
+
+int Fl_X11_Window_Driver::decorated_h()
+{
+ int w, h;
+ decorated_win_size(w, h);
+ return h;
+}
+
+int Fl_X11_Window_Driver::decorated_w()
+{
+ int w, h;
+
+ decorated_win_size(w, h);
+ return w;
+}
+
+
+
void Fl_X11_Window_Driver::take_focus()
{
Fl_X *i = Fl_X::i(pWindow);