aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGediminas Liktaras <gliktaras@gmail.com>2011-10-20 07:41:25 (GMT)
committerMathias Gumz <mathias gumz at gmail com>2011-10-20 07:41:55 (GMT)
commit12f44680dfefde602f3387c6d385f4c5e68990e4 (patch)
treea340aa064066988b6425009d961a3f971f3d3d4f /src
parentb2b65dea7f766942f1a7a7e34b8815c5dbb996a8 (diff)
downloadfluxbox_paul-12f44680dfefde602f3387c6d385f4c5e68990e4.zip
fluxbox_paul-12f44680dfefde602f3387c6d385f4c5e68990e4.tar.bz2
Added support for ARGB visual, patch #3284774
fluxbox now properly displays windows that require ARGB visuals when an external compositor is running. This was done by creating the container window with the correct visual and colormap when needed. Closes #2874629
Diffstat (limited to 'src')
-rw-r--r--src/FbRootWindow.cc35
-rw-r--r--src/FbRootWindow.hh8
-rw-r--r--src/FbTk/FbWindow.cc29
-rw-r--r--src/FbTk/FbWindow.hh14
-rw-r--r--src/FbWinFrame.cc32
-rw-r--r--src/FbWinFrame.hh2
-rw-r--r--src/Window.cc2
7 files changed, 90 insertions, 32 deletions
diff --git a/src/FbRootWindow.cc b/src/FbRootWindow.cc
index 7e2b77e..e329719 100644
--- a/src/FbRootWindow.cc
+++ b/src/FbRootWindow.cc
@@ -27,10 +27,20 @@
27FbRootWindow::FbRootWindow(int screen_num): 27FbRootWindow::FbRootWindow(int screen_num):
28 FbTk::FbWindow(RootWindow(FbTk::App::instance()->display(), screen_num)), 28 FbTk::FbWindow(RootWindow(FbTk::App::instance()->display(), screen_num)),
29 m_visual(0), 29 m_visual(0),
30 m_colormap(0) { 30 m_colormap(0),
31 m_decorationDepth(0),
32 m_decorationVisual(0),
33 m_decorationColormap(0) {
31 34
32 Display *disp = FbTk::App::instance()->display(); 35 Display *disp = FbTk::App::instance()->display();
33 36
37 m_visual = DefaultVisual(disp, screen_num);
38 m_colormap = DefaultColormap(disp, screen_num);
39
40 m_decorationDepth = DefaultDepth(disp, screen_num);
41 m_decorationVisual = DefaultVisual(disp, screen_num);
42 m_decorationColormap = DefaultColormap(disp, screen_num);
43
34 // search for a TrueColor Visual... if we can't find one... we will use the 44 // search for a TrueColor Visual... if we can't find one... we will use the
35 // default visual for the screen 45 // default visual for the screen
36 XVisualInfo vinfo_template, *vinfo_return; 46 XVisualInfo vinfo_template, *vinfo_return;
@@ -44,19 +54,26 @@ FbRootWindow::FbRootWindow(int screen_num):
44 vinfo_nitems > 0) { 54 vinfo_nitems > 0) {
45 55
46 for (int i = 0; i < vinfo_nitems; i++) { 56 for (int i = 0; i < vinfo_nitems; i++) {
47 // We can't handle 32-bit visuals just yet (Composite ARGB) 57 if ((DefaultDepth(disp, screen_num) < vinfo_return[i].depth)
48 if (vinfo_return[i].depth != 32 && DefaultDepth(disp, screen_num) < vinfo_return[i].depth) 58 && (depth() < vinfo_return[i].depth)){
49 m_visual = vinfo_return[i].visual; 59 m_visual = vinfo_return[i].visual;
60 setDepth(vinfo_return[i].depth);
61 }
62
63 if((m_decorationDepth < vinfo_return[i].depth)
64 && (vinfo_return[i].depth != 32)) {
65 m_decorationVisual = vinfo_return[i].visual;
66 m_decorationDepth = vinfo_return[i].depth;
67 }
50 } 68 }
51 69
52 XFree(vinfo_return); 70 XFree(vinfo_return);
53 } 71 }
54 72
55 if (m_visual) { 73 if (m_visual != DefaultVisual(disp, screen_num)) {
56 m_colormap = XCreateColormap(disp, window(), 74 m_colormap = XCreateColormap(disp, window(), m_visual, AllocNone);
57 m_visual, AllocNone); 75 }
58 } else { 76 if (m_decorationVisual != DefaultVisual(disp, screen_num)) {
59 m_visual = DefaultVisual(disp, screen_num); 77 m_decorationColormap = XCreateColormap(disp, window(), m_visual, AllocNone);
60 m_colormap = DefaultColormap(disp, screen_num);
61 } 78 }
62} 79}
diff --git a/src/FbRootWindow.hh b/src/FbRootWindow.hh
index 34b8219..8e97cc3 100644
--- a/src/FbRootWindow.hh
+++ b/src/FbRootWindow.hh
@@ -38,9 +38,17 @@ public:
38 Visual *visual() const { return m_visual; } 38 Visual *visual() const { return m_visual; }
39 Colormap colormap() const { return m_colormap; } 39 Colormap colormap() const { return m_colormap; }
40 40
41 int decorationDepth() const { return m_decorationDepth; }
42 Visual *decorationVisual() const { return m_decorationVisual; }
43 Colormap decorationColormap() const { return m_decorationColormap; }
44
41private: 45private:
42 Visual *m_visual; 46 Visual *m_visual;
43 Colormap m_colormap; 47 Colormap m_colormap;
48
49 int m_decorationDepth;
50 Visual *m_decorationVisual;
51 Colormap m_decorationColormap;
44}; 52};
45 53
46#endif // FBROOTWINDOW_HH 54#endif // FBROOTWINDOW_HH
diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc
index 9fa59fc..8362733 100644
--- a/src/FbTk/FbWindow.cc
+++ b/src/FbTk/FbWindow.cc
@@ -77,7 +77,9 @@ FbWindow::FbWindow(int screen_num,
77 bool override_redirect, 77 bool override_redirect,
78 bool save_unders, 78 bool save_unders,
79 unsigned int depth, 79 unsigned int depth,
80 int class_type): 80 int class_type,
81 Visual *visual,
82 Colormap cmap):
81 FbDrawable(), 83 FbDrawable(),
82 m_parent(0), 84 m_parent(0),
83 m_screen_num(screen_num), 85 m_screen_num(screen_num),
@@ -93,7 +95,7 @@ FbWindow::FbWindow(int screen_num,
93 95
94 create(RootWindow(display(), screen_num), 96 create(RootWindow(display(), screen_num),
95 x, y, width, height, eventmask, 97 x, y, width, height, eventmask,
96 override_redirect, save_unders, depth, class_type); 98 override_redirect, save_unders, depth, class_type, visual, cmap);
97} 99}
98 100
99FbWindow::FbWindow(const FbWindow &parent, 101FbWindow::FbWindow(const FbWindow &parent,
@@ -101,7 +103,10 @@ FbWindow::FbWindow(const FbWindow &parent,
101 long eventmask, 103 long eventmask,
102 bool override_redirect, 104 bool override_redirect,
103 bool save_unders, 105 bool save_unders,
104 unsigned int depth, int class_type): 106 unsigned int depth,
107 int class_type,
108 Visual *visual,
109 Colormap cmap):
105 FbDrawable(), 110 FbDrawable(),
106 m_parent(&parent), 111 m_parent(&parent),
107 m_screen_num(parent.screenNumber()), 112 m_screen_num(parent.screenNumber()),
@@ -113,9 +118,7 @@ FbWindow::FbWindow(const FbWindow &parent,
113 m_lastbg_pm(0), m_renderer(0) { 118 m_lastbg_pm(0), m_renderer(0) {
114 119
115 create(parent.window(), x, y, width, height, eventmask, 120 create(parent.window(), x, y, width, height, eventmask,
116 override_redirect, save_unders, depth, class_type); 121 override_redirect, save_unders, depth, class_type, visual, cmap);
117
118
119} 122}
120 123
121FbWindow::FbWindow(Window client): 124FbWindow::FbWindow(Window client):
@@ -634,9 +637,8 @@ bool FbWindow::updateGeometry() {
634void FbWindow::create(Window parent, int x, int y, 637void FbWindow::create(Window parent, int x, int y,
635 unsigned int width, unsigned int height, 638 unsigned int width, unsigned int height,
636 long eventmask, bool override_redirect, 639 long eventmask, bool override_redirect,
637 bool save_unders, unsigned int depth, int class_type) { 640 bool save_unders, unsigned int depth, int class_type,
638 641 Visual *visual, Colormap cmap) {
639
640 m_border_width = 0; 642 m_border_width = 0;
641 m_border_color = 0; 643 m_border_color = 0;
642 644
@@ -654,11 +656,18 @@ void FbWindow::create(Window parent, int x, int y,
654 values.save_under = True; 656 values.save_under = True;
655 } 657 }
656 658
659 if (cmap != CopyFromParent) {
660 valmask |= CWColormap | CWBackPixel | CWBorderPixel;
661 values.colormap = cmap;
662 values.background_pixel = XWhitePixel(display(), 0);
663 values.border_pixel = XBlackPixel(display(), 0);
664 }
665
657 m_window = XCreateWindow(display(), parent, x, y, width, height, 666 m_window = XCreateWindow(display(), parent, x, y, width, height,
658 0, // border width 667 0, // border width
659 depth, // depth 668 depth, // depth
660 class_type, // class 669 class_type, // class
661 CopyFromParent, // visual 670 visual, // visual
662 valmask, // create mask 671 valmask, // create mask
663 &values); // create atrribs 672 &values); // create atrribs
664 673
diff --git a/src/FbTk/FbWindow.hh b/src/FbTk/FbWindow.hh
index 6f6a558..e03083c 100644
--- a/src/FbTk/FbWindow.hh
+++ b/src/FbTk/FbWindow.hh
@@ -57,7 +57,9 @@ public:
57 bool overrride_redirect = false, 57 bool overrride_redirect = false,
58 bool save_unders = false, 58 bool save_unders = false,
59 unsigned int depth = CopyFromParent, 59 unsigned int depth = CopyFromParent,
60 int class_type = InputOutput); 60 int class_type = InputOutput,
61 Visual *visual = CopyFromParent,
62 Colormap cmap = CopyFromParent);
61 63
62 FbWindow(const FbWindow &parent, 64 FbWindow(const FbWindow &parent,
63 int x, int y, 65 int x, int y,
@@ -66,7 +68,9 @@ public:
66 bool overrride_redirect = false, 68 bool overrride_redirect = false,
67 bool save_unders = false, 69 bool save_unders = false,
68 unsigned int depth = CopyFromParent, 70 unsigned int depth = CopyFromParent,
69 int class_type = InputOutput); 71 int class_type = InputOutput,
72 Visual *visual = CopyFromParent,
73 Colormap cmap = CopyFromParent);
70 74
71 virtual ~FbWindow(); 75 virtual ~FbWindow();
72 virtual void setBackgroundColor(const FbTk::Color &bg_color); 76 virtual void setBackgroundColor(const FbTk::Color &bg_color);
@@ -207,6 +211,8 @@ protected:
207 /// creates a window with x window client (m_window = client) 211 /// creates a window with x window client (m_window = client)
208 explicit FbWindow(Window client); 212 explicit FbWindow(Window client);
209 213
214 void setDepth(unsigned int depth) { m_depth = depth; }
215
210private: 216private:
211 /// sets new X window and destroys old 217 /// sets new X window and destroys old
212 void setNew(Window win); 218 void setNew(Window win);
@@ -216,7 +222,9 @@ private:
216 bool override_redirect, 222 bool override_redirect,
217 bool save_unders, 223 bool save_unders,
218 unsigned int depth, 224 unsigned int depth,
219 int class_type); 225 int class_type,
226 Visual *visual,
227 Colormap cmap);
220 228
221 const FbWindow *m_parent; ///< parent FbWindow 229 const FbWindow *m_parent; ///< parent FbWindow
222 int m_screen_num; ///< screen num on which this window exist 230 int m_screen_num; ///< screen num on which this window exist
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index a8ee4d5..53cecf7 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -45,7 +45,8 @@ using std::string;
45 45
46using FbTk::STLUtil::forAll; 46using FbTk::STLUtil::forAll;
47 47
48FbWinFrame::FbWinFrame(BScreen &screen, WindowState &state, 48FbWinFrame::FbWinFrame(BScreen &screen, unsigned int client_depth,
49 WindowState &state,
49 FocusableTheme<FbWinFrameTheme> &theme): 50 FocusableTheme<FbWinFrameTheme> &theme):
50 m_screen(screen), 51 m_screen(screen),
51 m_theme(theme), 52 m_theme(theme),
@@ -54,26 +55,41 @@ FbWinFrame::FbWinFrame(BScreen &screen, WindowState &state,
54 m_window(theme->screenNum(), state.x, state.y, state.width, state.height, 55 m_window(theme->screenNum(), state.x, state.y, state.width, state.height,
55 ButtonPressMask | ButtonReleaseMask | 56 ButtonPressMask | ButtonReleaseMask |
56 ButtonMotionMask | EnterWindowMask | 57 ButtonMotionMask | EnterWindowMask |
57 LeaveWindowMask, true), 58 LeaveWindowMask, true, false,
59 client_depth, InputOutput,
60 ((client_depth == 32) && (screen.rootWindow().depth() == 32) ? screen.rootWindow().visual() : CopyFromParent),
61 ((client_depth == 32) && (screen.rootWindow().depth() == 32) ? screen.rootWindow().colormap() : CopyFromParent)),
58 m_layeritem(window(), *screen.layerManager().getLayer(ResourceLayer::NORMAL)), 62 m_layeritem(window(), *screen.layerManager().getLayer(ResourceLayer::NORMAL)),
59 m_titlebar(m_window, 0, 0, 100, 16, 63 m_titlebar(m_window, 0, 0, 100, 16,
60 ButtonPressMask | ButtonReleaseMask | 64 ButtonPressMask | ButtonReleaseMask |
61 ButtonMotionMask | ExposureMask | 65 ButtonMotionMask | ExposureMask |
62 EnterWindowMask | LeaveWindowMask), 66 EnterWindowMask | LeaveWindowMask,
67 false, false, screen.rootWindow().decorationDepth(), InputOutput,
68 screen.rootWindow().decorationVisual(),
69 screen.rootWindow().decorationColormap()),
63 m_tab_container(m_titlebar), 70 m_tab_container(m_titlebar),
64 m_label(m_titlebar, m_theme->font(), FbTk::BiDiString("")), 71 m_label(m_titlebar, m_theme->font(), FbTk::BiDiString("")),
65 m_handle(m_window, 0, 0, 100, 5, 72 m_handle(m_window, 0, 0, 100, 5,
66 ButtonPressMask | ButtonReleaseMask | 73 ButtonPressMask | ButtonReleaseMask |
67 ButtonMotionMask | ExposureMask | 74 ButtonMotionMask | ExposureMask |
68 EnterWindowMask | LeaveWindowMask), 75 EnterWindowMask | LeaveWindowMask,
76 false, false, screen.rootWindow().decorationDepth(), InputOutput,
77 screen.rootWindow().decorationVisual(),
78 screen.rootWindow().decorationColormap()),
69 m_grip_right(m_handle, 0, 0, 10, 4, 79 m_grip_right(m_handle, 0, 0, 10, 4,
70 ButtonPressMask | ButtonReleaseMask | 80 ButtonPressMask | ButtonReleaseMask |
71 ButtonMotionMask | ExposureMask | 81 ButtonMotionMask | ExposureMask |
72 EnterWindowMask | LeaveWindowMask), 82 EnterWindowMask | LeaveWindowMask,
83 false, false, screen.rootWindow().decorationDepth(), InputOutput,
84 screen.rootWindow().decorationVisual(),
85 screen.rootWindow().decorationColormap()),
73 m_grip_left(m_handle, 0, 0, 10, 4, 86 m_grip_left(m_handle, 0, 0, 10, 4,
74 ButtonPressMask | ButtonReleaseMask | 87 ButtonPressMask | ButtonReleaseMask |
75 ButtonMotionMask | ExposureMask | 88 ButtonMotionMask | ExposureMask |
76 EnterWindowMask | LeaveWindowMask), 89 EnterWindowMask | LeaveWindowMask,
90 false, false, screen.rootWindow().decorationDepth(), InputOutput,
91 screen.rootWindow().decorationVisual(),
92 screen.rootWindow().decorationColormap()),
77 m_clientarea(m_window, 0, 0, 100, 100, 93 m_clientarea(m_window, 0, 0, 100, 100,
78 ButtonPressMask | ButtonReleaseMask | 94 ButtonPressMask | ButtonReleaseMask |
79 ButtonMotionMask | ExposureMask | 95 ButtonMotionMask | ExposureMask |
diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh
index 5e13301..347a668 100644
--- a/src/FbWinFrame.hh
+++ b/src/FbWinFrame.hh
@@ -70,7 +70,7 @@ public:
70 }; 70 };
71 71
72 /// create a top level window 72 /// create a top level window
73 FbWinFrame(BScreen &screen, WindowState &state, 73 FbWinFrame(BScreen &screen, unsigned int client_depth, WindowState &state,
74 FocusableTheme<FbWinFrameTheme> &theme); 74 FocusableTheme<FbWinFrameTheme> &theme);
75 75
76/* /// create a frame window inside another FbWindow, NOT IMPLEMENTED! 76/* /// create a frame window inside another FbWindow, NOT IMPLEMENTED!
diff --git a/src/Window.cc b/src/Window.cc
index 6e60a80..db5bacc 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -281,7 +281,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client):
281 screen().unfocusedWinButtonTheme()), 281 screen().unfocusedWinButtonTheme()),
282 m_theme(*this, screen().focusedWinFrameTheme(), 282 m_theme(*this, screen().focusedWinFrameTheme(),
283 screen().unfocusedWinFrameTheme()), 283 screen().unfocusedWinFrameTheme()),
284 m_frame(client.screen(), m_state, m_theme), 284 m_frame(client.screen(), client.depth(), m_state, m_theme),
285 m_placed(false), 285 m_placed(false),
286 m_old_layernum(0), 286 m_old_layernum(0),
287 m_parent(client.screen().rootWindow()), 287 m_parent(client.screen().rootWindow()),