diff options
author | Jim Ramsay <i.am@jimramsay.com> | 2009-05-01 22:15:34 (GMT) |
---|---|---|
committer | Jim Ramsay <i.am@jimramsay.com> | 2009-05-01 22:15:34 (GMT) |
commit | 8c7f2ea10eadb76de4eb42d1b4c841171539db17 (patch) | |
tree | bcf79ecd06a138ac560d79324aa80bebd08677d4 | |
parent | dfa360e8905509e3e19db4279fc4066e52014676 (diff) | |
download | fluxbox_lack-8c7f2ea10eadb76de4eb42d1b4c841171539db17.zip fluxbox_lack-8c7f2ea10eadb76de4eb42d1b4c841171539db17.tar.bz2 |
Everything but Text
Managed 32-bit visuals for everything, but text is broken (menus, titlebars,
etc)
-rw-r--r-- | src/Ewmh.cc | 4 | ||||
-rw-r--r-- | src/FbRootWindow.cc | 17 | ||||
-rw-r--r-- | src/FbRootWindow.hh | 2 | ||||
-rw-r--r-- | src/FbTk/App.cc | 34 | ||||
-rw-r--r-- | src/FbTk/App.hh | 19 | ||||
-rw-r--r-- | src/FbTk/Color.cc | 83 | ||||
-rw-r--r-- | src/FbTk/Color.hh | 18 | ||||
-rw-r--r-- | src/FbTk/FbWindow.cc | 37 | ||||
-rw-r--r-- | src/FbTk/FbWindow.hh | 8 | ||||
-rw-r--r-- | src/FbTk/ImageControl.cc | 6 | ||||
-rw-r--r-- | src/FbTk/ImageImlib2.cc | 4 | ||||
-rw-r--r-- | src/FbTk/Menu.cc | 3 | ||||
-rw-r--r-- | src/FbTk/Shape.cc | 2 | ||||
-rw-r--r-- | src/FbTk/Texture.cc | 2 | ||||
-rw-r--r-- | src/FbTk/TextureRender.cc | 2 | ||||
-rw-r--r-- | src/FbTk/Transparent.cc | 6 | ||||
-rw-r--r-- | src/FbTk/XFontImp.cc | 4 | ||||
-rw-r--r-- | src/FbTk/XftFontImp.cc | 18 | ||||
-rw-r--r-- | src/FbWinFrame.cc | 5 | ||||
-rw-r--r-- | src/IconButton.cc | 2 | ||||
-rw-r--r-- | src/Screen.cc | 4 | ||||
-rw-r--r-- | src/Toolbar.cc | 2 | ||||
-rw-r--r-- | src/WinButton.cc | 3 | ||||
-rw-r--r-- | src/WinClient.cc | 6 | ||||
-rw-r--r-- | src/WinClient.hh | 3 | ||||
-rw-r--r-- | src/fluxbox.cc | 3 |
26 files changed, 233 insertions, 64 deletions
diff --git a/src/Ewmh.cc b/src/Ewmh.cc index b64a95d..3579461 100644 --- a/src/Ewmh.cc +++ b/src/Ewmh.cc | |||
@@ -195,7 +195,7 @@ void extractNetWmIcon(Atom net_wm_icon, WinClient& winclient) { | |||
195 | height = icon_data.begin()->first.second; | 195 | height = icon_data.begin()->first.second; |
196 | 196 | ||
197 | // tmp image for the pixmap | 197 | // tmp image for the pixmap |
198 | XImage* img_pm = XCreateImage(dpy, DefaultVisual(dpy, scrn), winclient.depth(), | 198 | XImage* img_pm = XCreateImage(dpy, FbTk::App::instance()->defaultVisual(scrn), winclient.depth(), |
199 | ZPixmap, | 199 | ZPixmap, |
200 | 0, NULL, width, height, 32, 0); | 200 | 0, NULL, width, height, 32, 0); |
201 | if (!img_pm) { | 201 | if (!img_pm) { |
@@ -204,7 +204,7 @@ void extractNetWmIcon(Atom net_wm_icon, WinClient& winclient) { | |||
204 | } | 204 | } |
205 | 205 | ||
206 | // tmp image for the mask | 206 | // tmp image for the mask |
207 | XImage* img_mask = XCreateImage(dpy, DefaultVisual(dpy, scrn), 1, | 207 | XImage* img_mask = XCreateImage(dpy, FbTk::App::instance()->defaultVisual(scrn), 1, |
208 | XYBitmap, | 208 | XYBitmap, |
209 | 0, NULL, width, height, 32, 0); | 209 | 0, NULL, width, height, 32, 0); |
210 | 210 | ||
diff --git a/src/FbRootWindow.cc b/src/FbRootWindow.cc index 7e2b77e..1d92441 100644 --- a/src/FbRootWindow.cc +++ b/src/FbRootWindow.cc | |||
@@ -24,10 +24,13 @@ | |||
24 | #include "FbTk/App.hh" | 24 | #include "FbTk/App.hh" |
25 | #include <X11/Xutil.h> | 25 | #include <X11/Xutil.h> |
26 | 26 | ||
27 | #include <iostream> | ||
28 | |||
27 | FbRootWindow::FbRootWindow(int screen_num): | 29 | FbRootWindow::FbRootWindow(int screen_num): |
28 | FbTk::FbWindow(RootWindow(FbTk::App::instance()->display(), screen_num)), | 30 | FbTk::FbWindow(RootWindow(FbTk::App::instance()->display(), screen_num)), |
29 | m_visual(0), | 31 | m_visual(0), |
30 | m_colormap(0) { | 32 | m_colormap(0), |
33 | m_depth(0) { | ||
31 | 34 | ||
32 | Display *disp = FbTk::App::instance()->display(); | 35 | Display *disp = FbTk::App::instance()->display(); |
33 | 36 | ||
@@ -44,9 +47,13 @@ FbRootWindow::FbRootWindow(int screen_num): | |||
44 | vinfo_nitems > 0) { | 47 | vinfo_nitems > 0) { |
45 | 48 | ||
46 | for (int i = 0; i < vinfo_nitems; i++) { | 49 | for (int i = 0; i < vinfo_nitems; i++) { |
47 | // We can't handle 32-bit visuals just yet (Composite ARGB) | 50 | if (DefaultDepth(disp, screen_num) < vinfo_return[i].depth) { |
48 | if (vinfo_return[i].depth != 32 && DefaultDepth(disp, screen_num) < vinfo_return[i].depth) | ||
49 | m_visual = vinfo_return[i].visual; | 51 | m_visual = vinfo_return[i].visual; |
52 | m_depth = vinfo_return[i].depth; | ||
53 | fprintf(stderr, "visual 0x%02x with depth %d\n", | ||
54 | (unsigned)XVisualIDFromVisual(m_visual), | ||
55 | m_depth); | ||
56 | } | ||
50 | } | 57 | } |
51 | 58 | ||
52 | XFree(vinfo_return); | 59 | XFree(vinfo_return); |
@@ -55,8 +62,12 @@ FbRootWindow::FbRootWindow(int screen_num): | |||
55 | if (m_visual) { | 62 | if (m_visual) { |
56 | m_colormap = XCreateColormap(disp, window(), | 63 | m_colormap = XCreateColormap(disp, window(), |
57 | m_visual, AllocNone); | 64 | m_visual, AllocNone); |
65 | FbTk::App::instance()->registerScreenDefaults(screen_num, m_visual, m_colormap, m_depth); | ||
58 | } else { | 66 | } else { |
59 | m_visual = DefaultVisual(disp, screen_num); | 67 | m_visual = DefaultVisual(disp, screen_num); |
60 | m_colormap = DefaultColormap(disp, screen_num); | 68 | m_colormap = DefaultColormap(disp, screen_num); |
69 | m_depth = DefaultDepth(disp, screen_num); | ||
70 | fprintf(stderr, "Falling back to default visual 0x%02x\n", | ||
71 | (unsigned)XVisualIDFromVisual(m_visual)); | ||
61 | } | 72 | } |
62 | } | 73 | } |
diff --git a/src/FbRootWindow.hh b/src/FbRootWindow.hh index 34b8219..7e33b5a 100644 --- a/src/FbRootWindow.hh +++ b/src/FbRootWindow.hh | |||
@@ -37,10 +37,12 @@ public: | |||
37 | FbTk::FbWindow &operator = (Window win) { return *this; } | 37 | FbTk::FbWindow &operator = (Window win) { return *this; } |
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 | unsigned int depth() const { return m_depth; } | ||
40 | 41 | ||
41 | private: | 42 | private: |
42 | Visual *m_visual; | 43 | Visual *m_visual; |
43 | Colormap m_colormap; | 44 | Colormap m_colormap; |
45 | unsigned int m_depth; | ||
44 | }; | 46 | }; |
45 | 47 | ||
46 | #endif // FBROOTWINDOW_HH | 48 | #endif // FBROOTWINDOW_HH |
diff --git a/src/FbTk/App.cc b/src/FbTk/App.cc index 39cd36e..a70aa82 100644 --- a/src/FbTk/App.cc +++ b/src/FbTk/App.cc | |||
@@ -36,7 +36,9 @@ App *App::instance() { | |||
36 | return s_app; | 36 | return s_app; |
37 | } | 37 | } |
38 | 38 | ||
39 | App::App(const char *displayname):m_done(false), m_display(0) { | 39 | App::App(const char *displayname): |
40 | m_done(false), m_display(0) | ||
41 | { | ||
40 | if (s_app != 0) | 42 | if (s_app != 0) |
41 | throw std::string("Can't create more than one instance of FbTk::App"); | 43 | throw std::string("Can't create more than one instance of FbTk::App"); |
42 | s_app = this; | 44 | s_app = this; |
@@ -79,4 +81,34 @@ void App::end() { | |||
79 | m_done = true; //end loop in App::eventLoop | 81 | m_done = true; //end loop in App::eventLoop |
80 | } | 82 | } |
81 | 83 | ||
84 | void App::registerScreenDefaults(unsigned int screen, Visual *visual, Colormap cmap, unsigned int depth) { | ||
85 | ScreenDflt d(visual, cmap, depth); | ||
86 | |||
87 | m_screen_defaults[screen] = d; | ||
88 | } | ||
89 | |||
90 | Visual *App::defaultVisual(unsigned int screen) { | ||
91 | if (m_screen_defaults.find(screen) != m_screen_defaults.end()) { | ||
92 | return m_screen_defaults[screen].visual; | ||
93 | } | ||
94 | |||
95 | return DefaultVisual(display(), screen); | ||
96 | } | ||
97 | |||
98 | Colormap App::defaultColormap(unsigned int screen) { | ||
99 | if (m_screen_defaults.find(screen) != m_screen_defaults.end()) { | ||
100 | return m_screen_defaults[screen].cmap; | ||
101 | } | ||
102 | |||
103 | return DefaultColormap(display(), screen); | ||
104 | } | ||
105 | |||
106 | int App::defaultDepth(unsigned int screen) { | ||
107 | if (m_screen_defaults.find(screen) != m_screen_defaults.end()) { | ||
108 | return m_screen_defaults[screen].depth; | ||
109 | } | ||
110 | |||
111 | return DefaultDepth(display(), screen); | ||
112 | } | ||
113 | |||
82 | } // end namespace FbTk | 114 | } // end namespace FbTk |
diff --git a/src/FbTk/App.hh b/src/FbTk/App.hh index d878661..4399551 100644 --- a/src/FbTk/App.hh +++ b/src/FbTk/App.hh | |||
@@ -23,6 +23,9 @@ | |||
23 | #define FBTK_APP_HH | 23 | #define FBTK_APP_HH |
24 | 24 | ||
25 | #include <X11/Xlib.h> | 25 | #include <X11/Xlib.h> |
26 | #include <map> | ||
27 | |||
28 | using std::map; | ||
26 | 29 | ||
27 | namespace FbTk { | 30 | namespace FbTk { |
28 | 31 | ||
@@ -47,6 +50,13 @@ public: | |||
47 | virtual ~App(); | 50 | virtual ~App(); |
48 | /// display connection | 51 | /// display connection |
49 | Display *display() const { return m_display; } | 52 | Display *display() const { return m_display; } |
53 | |||
54 | /// Registers a screen's default values for global retrieval | ||
55 | void registerScreenDefaults(unsigned int screen, Visual *visual, Colormap cmap, unsigned int depth); | ||
56 | Visual *defaultVisual(unsigned int screen); | ||
57 | Colormap defaultColormap(unsigned int screen); | ||
58 | int defaultDepth(unsigned int screen); | ||
59 | |||
50 | void sync(bool discard); | 60 | void sync(bool discard); |
51 | /// starts event loop | 61 | /// starts event loop |
52 | virtual void eventLoop(); | 62 | virtual void eventLoop(); |
@@ -57,6 +67,15 @@ private: | |||
57 | static App *s_app; | 67 | static App *s_app; |
58 | bool m_done; | 68 | bool m_done; |
59 | Display *m_display; | 69 | Display *m_display; |
70 | |||
71 | struct ScreenDflt { | ||
72 | ScreenDflt(): visual(0), cmap(0), depth(0) {} | ||
73 | ScreenDflt(Visual *v, Colormap c, int d): visual(v), cmap(c), depth(d) {} | ||
74 | Visual *visual; | ||
75 | Colormap cmap; | ||
76 | int depth; | ||
77 | }; | ||
78 | map<int, ScreenDflt> m_screen_defaults; | ||
60 | }; | 79 | }; |
61 | 80 | ||
62 | } // end namespace FbTk | 81 | } // end namespace FbTk |
diff --git a/src/FbTk/Color.cc b/src/FbTk/Color.cc index 2cd4278..ae35a94 100644 --- a/src/FbTk/Color.cc +++ b/src/FbTk/Color.cc | |||
@@ -31,6 +31,10 @@ using std::cerr; | |||
31 | using std::endl; | 31 | using std::endl; |
32 | using std::string; | 32 | using std::string; |
33 | 33 | ||
34 | #if HAVE_XRENDER | ||
35 | #include <X11/Xft/Xft.h> | ||
36 | #endif | ||
37 | |||
34 | namespace { | 38 | namespace { |
35 | 39 | ||
36 | inline unsigned char maxValue(unsigned short colval) { | 40 | inline unsigned char maxValue(unsigned short colval) { |
@@ -50,19 +54,31 @@ Color::Color(): | |||
50 | } | 54 | } |
51 | 55 | ||
52 | Color::Color(const Color &col_copy): | 56 | Color::Color(const Color &col_copy): |
53 | m_red(0), m_green(0), m_blue(0), | 57 | m_red(0), m_green(0), m_blue(0), m_alpha(0), |
54 | m_pixel(0), | 58 | m_pixel(0), |
55 | m_allocated(false), m_screen(0) { | 59 | m_allocated(false), m_screen(0) { |
56 | copy(col_copy); | 60 | copy(col_copy); |
57 | } | 61 | } |
58 | 62 | ||
59 | Color::Color(unsigned short red, unsigned short green, unsigned short blue, int screen): | 63 | Color::Color(unsigned short red, unsigned short green, unsigned short blue, int screen): |
60 | m_red(red), m_green(green), m_blue(blue), | 64 | m_red(red), m_green(green), m_blue(blue), m_alpha(0), |
61 | m_pixel(0), m_allocated(false), | 65 | m_pixel(0), m_allocated(false), |
62 | m_screen(screen) { | 66 | m_screen(screen) { |
63 | allocate(red, green, blue, screen); | 67 | |
68 | printf("Color: New RGB color: %d/%d/%d\n", red, green, blue); | ||
69 | allocate(red, green, blue, 0, screen); | ||
64 | } | 70 | } |
65 | 71 | ||
72 | Color::Color(unsigned short red, unsigned short green, unsigned short blue, unsigned short alpha, int screen): | ||
73 | m_red(red), m_green(green), m_blue(blue), m_alpha(alpha), | ||
74 | m_pixel(0), m_allocated(false), | ||
75 | m_screen(screen) { | ||
76 | |||
77 | printf("Color: New RGB color: %d/%d/%d/%d\n", red, green, blue, alpha); | ||
78 | allocate(red, green, blue, alpha, screen); | ||
79 | } | ||
80 | |||
81 | |||
66 | Color::Color(const char *color_string, int screen): | 82 | Color::Color(const char *color_string, int screen): |
67 | m_red(0), m_green(0), m_blue(0), | 83 | m_red(0), m_green(0), m_blue(0), |
68 | m_pixel(0), | 84 | m_pixel(0), |
@@ -86,29 +102,23 @@ bool Color::setFromString(const char *color_string, int screen) { | |||
86 | StringUtil::removeTrailingWhitespace(color_string_tmp); | 102 | StringUtil::removeTrailingWhitespace(color_string_tmp); |
87 | 103 | ||
88 | Display *disp = App::instance()->display(); | 104 | Display *disp = App::instance()->display(); |
89 | Colormap colm = DefaultColormap(disp, screen); | 105 | Colormap colm = App::instance()->defaultColormap(screen); |
90 | 106 | ||
91 | XColor color; | 107 | XColor color; |
92 | 108 | ||
109 | printf("Color: Parsing color string %s\n", color_string_tmp.c_str()); | ||
93 | if (! XParseColor(disp, colm, color_string_tmp.c_str(), &color)) | 110 | if (! XParseColor(disp, colm, color_string_tmp.c_str(), &color)) |
94 | return false; | 111 | return false; |
95 | else if (! XAllocColor(disp, colm, &color)) | ||
96 | return false; | ||
97 | 112 | ||
98 | setPixel(color.pixel); | 113 | allocate(color.red, color.green, color.blue, 0, screen); |
99 | setRGB(maxValue(color.red), | ||
100 | maxValue(color.green), | ||
101 | maxValue(color.blue)); | ||
102 | setAllocated(true); | ||
103 | m_screen = screen; | ||
104 | 114 | ||
105 | return true; | 115 | return isAllocated(); |
106 | } | 116 | } |
107 | 117 | ||
108 | bool Color::validColorString(const char *color_string, int screen) { | 118 | bool Color::validColorString(const char *color_string, int screen) { |
109 | XColor color; | 119 | XColor color; |
110 | Display *disp = App::instance()->display(); | 120 | Display *disp = App::instance()->display(); |
111 | Colormap colm = DefaultColormap(disp, screen); | 121 | Colormap colm = App::instance()->defaultColormap(screen); |
112 | // trim white space | 122 | // trim white space |
113 | string color_string_tmp = color_string; | 123 | string color_string_tmp = color_string; |
114 | StringUtil::removeFirstWhitespace(color_string_tmp); | 124 | StringUtil::removeFirstWhitespace(color_string_tmp); |
@@ -129,9 +139,14 @@ Color &Color::operator = (const Color &col_copy) { | |||
129 | 139 | ||
130 | void Color::free() { | 140 | void Color::free() { |
131 | if (isAllocated()) { | 141 | if (isAllocated()) { |
132 | unsigned long pixel = m_pixel; | ||
133 | Display *disp = App::instance()->display(); | 142 | Display *disp = App::instance()->display(); |
134 | XFreeColors(disp, DefaultColormap(disp, m_screen), &pixel, 1, 0); | 143 | #if HAVE_XRENDER |
144 | XftColorFree(disp, App::instance()->defaultVisual(m_screen), | ||
145 | App::instance()->defaultColormap(m_screen), &m_xftcolor); | ||
146 | #else /* No XRENDER */ | ||
147 | unsigned long pixel = m_pixel; | ||
148 | XFreeColors(disp, App::instance()->defaultColormap(m_screen), &pixel, 1, 0); | ||
149 | #endif | ||
135 | setPixel(0); | 150 | setPixel(0); |
136 | setRGB(0, 0, 0); | 151 | setRGB(0, 0, 0); |
137 | setAllocated(false); | 152 | setAllocated(false); |
@@ -149,39 +164,69 @@ void Color::copy(const Color &col_copy) { | |||
149 | allocate(col_copy.red()*0x101, | 164 | allocate(col_copy.red()*0x101, |
150 | col_copy.green()*0x101, | 165 | col_copy.green()*0x101, |
151 | col_copy.blue()*0x101, | 166 | col_copy.blue()*0x101, |
167 | col_copy.alpha()*0x101, | ||
152 | col_copy.m_screen); | 168 | col_copy.m_screen); |
153 | 169 | ||
154 | } | 170 | } |
155 | 171 | ||
156 | void Color::allocate(unsigned short red, unsigned short green, unsigned short blue, int screen) { | 172 | void Color::allocate(unsigned short red, unsigned short green, unsigned short blue, unsigned short alpha, int screen) { |
157 | 173 | ||
158 | Display *disp = App::instance()->display(); | 174 | Display *disp = App::instance()->display(); |
175 | Colormap cmap = App::instance()->defaultColormap(screen); | ||
176 | int xresult; | ||
177 | |||
178 | #if HAVE_XRENDER | ||
179 | Visual *vis = App::instance()->defaultVisual(screen); | ||
180 | XRenderColor acolor; | ||
181 | acolor.red = red; | ||
182 | acolor.green = green; | ||
183 | acolor.blue = blue; | ||
184 | acolor.alpha = alpha; | ||
185 | |||
186 | xresult = XftColorAllocValue(disp, vis, cmap, &acolor, &m_xftcolor); | ||
187 | printf("Color: XftColorAllocValue(%04x/%04x/%04x/%04x) returned %d\n", | ||
188 | red, green, blue, alpha, xresult); | ||
189 | #else /* No XRENDER */ | ||
159 | XColor color; | 190 | XColor color; |
160 | // fill xcolor structure | 191 | // fill xcolor structure |
161 | color.red = red; | 192 | color.red = red; |
162 | color.green = green; | 193 | color.green = green; |
163 | color.blue = blue; | 194 | color.blue = blue; |
164 | 195 | ||
196 | xresult = XAllocColor(disp, cmap, &color); | ||
197 | printf("Color: XAllocColor(%04x/%04x/%04x) returned %d\n", | ||
198 | red, green, blue, xresult); | ||
199 | #endif | ||
165 | 200 | ||
166 | if (!XAllocColor(disp, DefaultColormap(disp, screen), &color)) { | 201 | if (!xresult) { |
167 | _FB_USES_NLS; | 202 | _FB_USES_NLS; |
168 | cerr<<"FbTk::Color: "<<_FBTK_CONSOLETEXT(Error, ColorAllocation, "Allocation error.", "XAllocColor failed...")<<endl; | 203 | cerr<<"FbTk::Color: "<<_FBTK_CONSOLETEXT(Error, ColorAllocation, "Allocation error.", "XAllocColor failed...")<<endl; |
169 | } else { | 204 | } else { |
170 | free(); | 205 | free(); |
206 | #if HAVE_XRENDER | ||
207 | setRGB(maxValue(m_xftcolor.color.red), | ||
208 | maxValue(m_xftcolor.color.green), | ||
209 | maxValue(m_xftcolor.color.blue), | ||
210 | maxValue(m_xftcolor.color.alpha)); | ||
211 | setPixel(m_xftcolor.pixel); | ||
212 | #else /* No XRENDER */ | ||
171 | setRGB(maxValue(color.red), | 213 | setRGB(maxValue(color.red), |
172 | maxValue(color.green), | 214 | maxValue(color.green), |
173 | maxValue(color.blue)); | 215 | maxValue(color.blue)); |
174 | setPixel(color.pixel); | 216 | setPixel(color.pixel); |
217 | #endif | ||
175 | setAllocated(true); | 218 | setAllocated(true); |
176 | } | 219 | } |
177 | 220 | ||
178 | m_screen = screen; | 221 | m_screen = screen; |
179 | } | 222 | } |
180 | 223 | ||
181 | void Color::setRGB(unsigned short red, unsigned short green, unsigned short blue) { | 224 | void Color::setRGB(unsigned short red, unsigned short green, unsigned short blue, |
225 | unsigned short alpha) { | ||
182 | m_red = red; | 226 | m_red = red; |
183 | m_green = green; | 227 | m_green = green; |
184 | m_blue = blue; | 228 | m_blue = blue; |
229 | m_alpha = alpha; | ||
185 | } | 230 | } |
186 | 231 | ||
187 | }; | 232 | }; |
diff --git a/src/FbTk/Color.hh b/src/FbTk/Color.hh index 588fcc1..ed36463 100644 --- a/src/FbTk/Color.hh +++ b/src/FbTk/Color.hh | |||
@@ -25,6 +25,11 @@ | |||
25 | #ifndef FBTK_COLOR_HH | 25 | #ifndef FBTK_COLOR_HH |
26 | #define FBTK_COLOR_HH | 26 | #define FBTK_COLOR_HH |
27 | 27 | ||
28 | #include <config.h> | ||
29 | #if HAVE_XRENDER | ||
30 | #include <X11/Xft/Xft.h> | ||
31 | #endif | ||
32 | |||
28 | namespace FbTk { | 33 | namespace FbTk { |
29 | 34 | ||
30 | /// Allocates rgb color and pixel value | 35 | /// Allocates rgb color and pixel value |
@@ -34,6 +39,7 @@ public: | |||
34 | explicit Color(unsigned long pixel); | 39 | explicit Color(unsigned long pixel); |
35 | Color(const Color &col_copy); | 40 | Color(const Color &col_copy); |
36 | Color(unsigned short red, unsigned short green, unsigned short blue, int screen); | 41 | Color(unsigned short red, unsigned short green, unsigned short blue, int screen); |
42 | Color(unsigned short red, unsigned short green, unsigned short blue, unsigned short alpha, int screen); | ||
37 | /// parses and sets rgb and pixel value from a string | 43 | /// parses and sets rgb and pixel value from a string |
38 | Color(const char *color_string, int screen); | 44 | Color(const char *color_string, int screen); |
39 | ~Color(); | 45 | ~Color(); |
@@ -49,6 +55,7 @@ public: | |||
49 | unsigned short red() const { return m_red; } | 55 | unsigned short red() const { return m_red; } |
50 | unsigned short green() const { return m_green; } | 56 | unsigned short green() const { return m_green; } |
51 | unsigned short blue() const { return m_blue; } | 57 | unsigned short blue() const { return m_blue; } |
58 | unsigned short alpha() const { return m_alpha; } | ||
52 | unsigned long pixel() const { return m_pixel; } | 59 | unsigned long pixel() const { return m_pixel; } |
53 | 60 | ||
54 | /// @return true if the color name in color_string is resolved, else false | 61 | /// @return true if the color name in color_string is resolved, else false |
@@ -58,12 +65,17 @@ private: | |||
58 | void free(); | 65 | void free(); |
59 | void copy(const Color &col); | 66 | void copy(const Color &col); |
60 | void allocate(unsigned short red, unsigned short green, | 67 | void allocate(unsigned short red, unsigned short green, |
61 | unsigned short blue, int screen); | 68 | unsigned short blue, unsigned short alpha, |
69 | int screen); | ||
62 | void setAllocated(bool a) { m_allocated = a; } | 70 | void setAllocated(bool a) { m_allocated = a; } |
63 | void setRGB(unsigned short red, unsigned short green, unsigned short blue); | 71 | void setRGB(unsigned short red, unsigned short green, unsigned short blue, |
72 | unsigned short alpha = 0); | ||
64 | 73 | ||
65 | 74 | ||
66 | unsigned short m_red, m_green, m_blue; | 75 | unsigned short m_red, m_green, m_blue, m_alpha; |
76 | #if HAVE_XRENDER | ||
77 | XftColor m_xftcolor; | ||
78 | #endif | ||
67 | unsigned long m_pixel; | 79 | unsigned long m_pixel; |
68 | bool m_allocated; | 80 | bool m_allocated; |
69 | int m_screen; | 81 | int m_screen; |
diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc index 2ef24fa..e1b27cd 100644 --- a/src/FbTk/FbWindow.cc +++ b/src/FbTk/FbWindow.cc | |||
@@ -72,9 +72,11 @@ FbWindow::FbWindow(int screen_num, | |||
72 | int x, int y, | 72 | int x, int y, |
73 | unsigned int width, unsigned int height, | 73 | unsigned int width, unsigned int height, |
74 | long eventmask, | 74 | long eventmask, |
75 | Visual *visual, | ||
76 | Colormap cmap, | ||
77 | unsigned int depth, | ||
75 | bool override_redirect, | 78 | bool override_redirect, |
76 | bool save_unders, | 79 | bool save_unders, |
77 | unsigned int depth, | ||
78 | int class_type): | 80 | int class_type): |
79 | FbDrawable(), | 81 | FbDrawable(), |
80 | m_parent(0), | 82 | m_parent(0), |
@@ -84,9 +86,18 @@ FbWindow::FbWindow(int screen_num, | |||
84 | m_lastbg_color(0), | 86 | m_lastbg_color(0), |
85 | m_lastbg_pm(0), m_renderer(0) { | 87 | m_lastbg_pm(0), m_renderer(0) { |
86 | 88 | ||
89 | XWindowAttributes a; | ||
90 | if (XGetWindowAttributes(display(), RootWindow(display(), screen_num), &a)) { | ||
91 | printf("Creating screen window. RootWindow visual is 0x%02x, requested visual is 0x%02x\n", | ||
92 | (unsigned int)XVisualIDFromVisual(a.visual), | ||
93 | visual == CopyFromParent ? 0xff : (unsigned int)XVisualIDFromVisual(visual)); | ||
94 | } else { | ||
95 | printf("Creating screen window. RootWindow visual is unknown, requested visual is 0x%02x\n", | ||
96 | visual == CopyFromParent ? 0xff : (unsigned int)XVisualIDFromVisual(visual)); | ||
97 | } | ||
87 | create(RootWindow(display(), screen_num), | 98 | create(RootWindow(display(), screen_num), |
88 | x, y, width, height, eventmask, | 99 | x, y, width, height, eventmask, |
89 | override_redirect, save_unders, depth, class_type); | 100 | override_redirect, save_unders, depth, class_type, visual, cmap); |
90 | }; | 101 | }; |
91 | 102 | ||
92 | FbWindow::FbWindow(const FbWindow &parent, | 103 | FbWindow::FbWindow(const FbWindow &parent, |
@@ -102,7 +113,7 @@ FbWindow::FbWindow(const FbWindow &parent, | |||
102 | m_lastbg_pm(0), m_renderer(0) { | 113 | m_lastbg_pm(0), m_renderer(0) { |
103 | 114 | ||
104 | create(parent.window(), x, y, width, height, eventmask, | 115 | create(parent.window(), x, y, width, height, eventmask, |
105 | override_redirect, save_unders, depth, class_type); | 116 | override_redirect, save_unders, depth, class_type, CopyFromParent); |
106 | 117 | ||
107 | 118 | ||
108 | }; | 119 | }; |
@@ -603,7 +614,8 @@ bool FbWindow::updateGeometry() { | |||
603 | void FbWindow::create(Window parent, int x, int y, | 614 | void FbWindow::create(Window parent, int x, int y, |
604 | unsigned int width, unsigned int height, | 615 | unsigned int width, unsigned int height, |
605 | long eventmask, bool override_redirect, | 616 | long eventmask, bool override_redirect, |
606 | bool save_unders, unsigned int depth, int class_type) { | 617 | bool save_unders, unsigned int depth, int class_type, |
618 | Visual *visual, Colormap cmap) { | ||
607 | 619 | ||
608 | 620 | ||
609 | m_border_width = 0; | 621 | m_border_width = 0; |
@@ -623,13 +635,28 @@ void FbWindow::create(Window parent, int x, int y, | |||
623 | values.save_under = True; | 635 | values.save_under = True; |
624 | } | 636 | } |
625 | 637 | ||
638 | if (cmap) { | ||
639 | valmask |= CWColormap | CWBackPixel | CWBorderPixel; | ||
640 | values.colormap = cmap; | ||
641 | /* For some reason, with a 32-bit visual, we need to set these */ | ||
642 | values.background_pixel = XWhitePixel(display(), 0); | ||
643 | values.border_pixel = XBlackPixel(display(), 0); | ||
644 | } | ||
645 | |||
646 | if (depth > 0 || cmap || visual) | ||
647 | printf("Creating window... depth %d, cmap %p, visual 0x%02x (%p)\n", | ||
648 | depth, (void*)cmap, | ||
649 | visual == CopyFromParent ? 0xff : (unsigned int)XVisualIDFromVisual(visual), | ||
650 | visual); | ||
626 | m_window = XCreateWindow(display(), parent, x, y, width, height, | 651 | m_window = XCreateWindow(display(), parent, x, y, width, height, |
627 | 0, // border width | 652 | 0, // border width |
628 | depth, // depth | 653 | depth, // depth |
629 | class_type, // class | 654 | class_type, // class |
630 | CopyFromParent, // visual | 655 | visual, // visual |
631 | valmask, // create mask | 656 | valmask, // create mask |
632 | &values); // create atrribs | 657 | &values); // create atrribs |
658 | if (depth > 0 || cmap || visual) | ||
659 | printf(" Complete\n"); | ||
633 | 660 | ||
634 | assert(m_window); | 661 | assert(m_window); |
635 | 662 | ||
diff --git a/src/FbTk/FbWindow.hh b/src/FbTk/FbWindow.hh index edeffe1..7cc6707 100644 --- a/src/FbTk/FbWindow.hh +++ b/src/FbTk/FbWindow.hh | |||
@@ -54,9 +54,11 @@ public: | |||
54 | 54 | ||
55 | FbWindow(int screen_num, | 55 | FbWindow(int screen_num, |
56 | int x, int y, unsigned int width, unsigned int height, long eventmask, | 56 | int x, int y, unsigned int width, unsigned int height, long eventmask, |
57 | Visual *visual = CopyFromParent, | ||
58 | Colormap cmap = 0, | ||
59 | unsigned int depth = CopyFromParent, | ||
57 | bool overrride_redirect = false, | 60 | bool overrride_redirect = false, |
58 | bool save_unders = false, | 61 | bool save_unders = false, |
59 | unsigned int depth = CopyFromParent, | ||
60 | int class_type = InputOutput); | 62 | int class_type = InputOutput); |
61 | 63 | ||
62 | FbWindow(const FbWindow &parent, | 64 | FbWindow(const FbWindow &parent, |
@@ -215,7 +217,9 @@ private: | |||
215 | bool override_redirect, | 217 | bool override_redirect, |
216 | bool save_unders, | 218 | bool save_unders, |
217 | unsigned int depth, | 219 | unsigned int depth, |
218 | int class_type); | 220 | int class_type, |
221 | Visual *visual, | ||
222 | Colormap cmap = 0); | ||
219 | 223 | ||
220 | const FbWindow *m_parent; ///< parent FbWindow | 224 | const FbWindow *m_parent; ///< parent FbWindow |
221 | int m_screen_num; ///< screen num on which this window exist | 225 | int m_screen_num; ///< screen num on which this window exist |
diff --git a/src/FbTk/ImageControl.cc b/src/FbTk/ImageControl.cc index 067bcde..277cb29 100644 --- a/src/FbTk/ImageControl.cc +++ b/src/FbTk/ImageControl.cc | |||
@@ -112,11 +112,11 @@ ImageControl::ImageControl(int screen_num, | |||
112 | 112 | ||
113 | Display *disp = FbTk::App::instance()->display(); | 113 | Display *disp = FbTk::App::instance()->display(); |
114 | 114 | ||
115 | m_screen_depth = DefaultDepth(disp, screen_num); | 115 | m_screen_depth = FbTk::App::instance()->defaultDepth(screen_num); |
116 | m_screen_num = screen_num; | 116 | m_screen_num = screen_num; |
117 | m_root_window = RootWindow(disp, screen_num); | 117 | m_root_window = RootWindow(disp, screen_num); |
118 | m_visual = DefaultVisual(disp, screen_num); | 118 | m_visual = FbTk::App::instance()->defaultVisual(screen_num); |
119 | m_colormap = DefaultColormap(disp, screen_num); | 119 | m_colormap = FbTk::App::instance()->defaultColormap(screen_num); |
120 | 120 | ||
121 | cache_max = cmax; | 121 | cache_max = cmax; |
122 | 122 | ||
diff --git a/src/FbTk/ImageImlib2.cc b/src/FbTk/ImageImlib2.cc index 9983604..d710c4f 100644 --- a/src/FbTk/ImageImlib2.cc +++ b/src/FbTk/ImageImlib2.cc | |||
@@ -91,8 +91,8 @@ PixmapWithMask *ImageImlib2::load(const std::string &filename, int screen_num) c | |||
91 | imlib_context_push(new_context); | 91 | imlib_context_push(new_context); |
92 | 92 | ||
93 | imlib_context_set_display(dpy); | 93 | imlib_context_set_display(dpy); |
94 | imlib_context_set_visual(DefaultVisual(dpy, screen_num)); | 94 | imlib_context_set_visual(FbTk::App::instance()->defaultVisual(screen_num)); |
95 | imlib_context_set_colormap(DefaultColormap(dpy, screen_num)); | 95 | imlib_context_set_colormap(FbTk::App::instance()->defaultColormap(screen_num)); |
96 | imlib_context_set_drawable(RootWindow(dpy, screen_num)); | 96 | imlib_context_set_drawable(RootWindow(dpy, screen_num)); |
97 | 97 | ||
98 | imlib_context_pop(); | 98 | imlib_context_pop(); |
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index 7cf2ac9..274dbd9 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc | |||
@@ -140,6 +140,9 @@ Menu::Menu(FbTk::ThemeProxy<MenuTheme> &tm, ImageControl &imgctrl): | |||
140 | menu.window = FbTk::FbWindow(tm->screenNum(), | 140 | menu.window = FbTk::FbWindow(tm->screenNum(), |
141 | 0, 0, 10, 10, | 141 | 0, 0, 10, 10, |
142 | event_mask, | 142 | event_mask, |
143 | 0, // cmap | ||
144 | CopyFromParent, // depth | ||
145 | CopyFromParent, // visual | ||
143 | true, // override redirect | 146 | true, // override redirect |
144 | true); // save_under | 147 | true); // save_under |
145 | 148 | ||
diff --git a/src/FbTk/Shape.cc b/src/FbTk/Shape.cc index 6bb63aa..4ff25bd 100644 --- a/src/FbTk/Shape.cc +++ b/src/FbTk/Shape.cc | |||
@@ -65,7 +65,7 @@ Pixmap makePixmap(FbWindow &drawable, const unsigned char rows[]) { | |||
65 | memset(data, 0xFF, data_size); | 65 | memset(data, 0xFF, data_size); |
66 | 66 | ||
67 | XImage *ximage = XCreateImage(disp, | 67 | XImage *ximage = XCreateImage(disp, |
68 | DefaultVisual(disp, drawable.screenNumber()), | 68 | App::instance()->defaultVisual(drawable.screenNumber()), |
69 | 1, | 69 | 1, |
70 | XYPixmap, 0, | 70 | XYPixmap, 0, |
71 | data, | 71 | data, |
diff --git a/src/FbTk/Texture.cc b/src/FbTk/Texture.cc index 2fcd915..2c13595 100644 --- a/src/FbTk/Texture.cc +++ b/src/FbTk/Texture.cc | |||
@@ -112,7 +112,7 @@ void Texture::setFromString(const char * const texture_str) { | |||
112 | void Texture::calcHiLoColors(int screen_num) { | 112 | void Texture::calcHiLoColors(int screen_num) { |
113 | Display *disp = FbTk::App::instance()->display(); | 113 | Display *disp = FbTk::App::instance()->display(); |
114 | XColor xcol; | 114 | XColor xcol; |
115 | Colormap colm = DefaultColormap(disp, screen_num); | 115 | Colormap colm = FbTk::App::instance()->defaultColormap(screen_num); |
116 | 116 | ||
117 | xcol.red = (unsigned int) (m_color.red() + | 117 | xcol.red = (unsigned int) (m_color.red() + |
118 | (m_color.red() >> 1)); | 118 | (m_color.red() >> 1)); |
diff --git a/src/FbTk/TextureRender.cc b/src/FbTk/TextureRender.cc index 73c1a94..fde995c 100644 --- a/src/FbTk/TextureRender.cc +++ b/src/FbTk/TextureRender.cc | |||
@@ -328,7 +328,7 @@ XImage *TextureRender::renderXImage() { | |||
328 | Display *disp = FbTk::App::instance()->display(); | 328 | Display *disp = FbTk::App::instance()->display(); |
329 | XImage *image = | 329 | XImage *image = |
330 | XCreateImage(disp, | 330 | XCreateImage(disp, |
331 | DefaultVisual(disp, control.screenNumber()), control.depth(), ZPixmap, 0, 0, | 331 | FbTk::App::instance()->defaultVisual(control.screenNumber()), control.depth(), ZPixmap, 0, 0, |
332 | width, height, 32, 0); | 332 | width, height, 32, 0); |
333 | 333 | ||
334 | if (! image) { | 334 | if (! image) { |
diff --git a/src/FbTk/Transparent.cc b/src/FbTk/Transparent.cc index 992678a..3d3a76e 100644 --- a/src/FbTk/Transparent.cc +++ b/src/FbTk/Transparent.cc | |||
@@ -167,7 +167,7 @@ Transparent::Transparent(Drawable src, Drawable dest, unsigned char alpha, int s | |||
167 | 167 | ||
168 | XRenderPictFormat *format = | 168 | XRenderPictFormat *format = |
169 | XRenderFindVisualFormat(disp, | 169 | XRenderFindVisualFormat(disp, |
170 | DefaultVisual(disp, screen_num)); | 170 | FbTk::App::instance()->defaultVisual(screen_num)); |
171 | 171 | ||
172 | if (src != 0 && format != 0) { | 172 | if (src != 0 && format != 0) { |
173 | m_src_pic = XRenderCreatePicture(disp, src, format, | 173 | m_src_pic = XRenderCreatePicture(disp, src, format, |
@@ -228,7 +228,7 @@ void Transparent::setDest(Drawable dest, int screen_num) { | |||
228 | 228 | ||
229 | XRenderPictFormat *format = | 229 | XRenderPictFormat *format = |
230 | XRenderFindVisualFormat(disp, | 230 | XRenderFindVisualFormat(disp, |
231 | DefaultVisual(disp, screen_num)); | 231 | FbTk::App::instance()->defaultVisual(screen_num)); |
232 | if (format == 0) { | 232 | if (format == 0) { |
233 | _FB_USES_NLS; | 233 | _FB_USES_NLS; |
234 | cerr<<"FbTk::Transparent: "; | 234 | cerr<<"FbTk::Transparent: "; |
@@ -272,7 +272,7 @@ void Transparent::setSource(Drawable source, int screen_num) { | |||
272 | 272 | ||
273 | XRenderPictFormat *format = | 273 | XRenderPictFormat *format = |
274 | XRenderFindVisualFormat(disp, | 274 | XRenderFindVisualFormat(disp, |
275 | DefaultVisual(disp, screen_num)); | 275 | FbTk::App::instance()->defaultVisual(screen_num)); |
276 | if (format == 0) { | 276 | if (format == 0) { |
277 | _FB_USES_NLS; | 277 | _FB_USES_NLS; |
278 | cerr<<"FbTk::Transparent: "; | 278 | cerr<<"FbTk::Transparent: "; |
diff --git a/src/FbTk/XFontImp.cc b/src/FbTk/XFontImp.cc index a94aa75..58bb07a 100644 --- a/src/FbTk/XFontImp.cc +++ b/src/FbTk/XFontImp.cc | |||
@@ -225,7 +225,7 @@ void XFontImp::rotate(FbTk::Orientation orient) { | |||
225 | // reserve memory for first XImage | 225 | // reserve memory for first XImage |
226 | vertdata = (unsigned char *)calloc((unsigned)(vert_len * vert_h), 1); | 226 | vertdata = (unsigned char *)calloc((unsigned)(vert_len * vert_h), 1); |
227 | 227 | ||
228 | XImage *I1 = XCreateImage(dpy, DefaultVisual(dpy, screen), | 228 | XImage *I1 = XCreateImage(dpy, App::instance()->defaultVisual(screen), |
229 | 1, XYBitmap, | 229 | 1, XYBitmap, |
230 | 0, (char *)vertdata, | 230 | 0, (char *)vertdata, |
231 | vert_w, vert_h, 8, 0); | 231 | vert_w, vert_h, 8, 0); |
@@ -269,7 +269,7 @@ void XFontImp::rotate(FbTk::Orientation orient) { | |||
269 | bitdata = (unsigned char *)calloc((unsigned)(bit_h * bit_len), 1); | 269 | bitdata = (unsigned char *)calloc((unsigned)(bit_h * bit_len), 1); |
270 | 270 | ||
271 | // create the image | 271 | // create the image |
272 | XImage *I2 = XCreateImage(dpy, DefaultVisual(dpy, screen), 1, XYBitmap, 0, | 272 | XImage *I2 = XCreateImage(dpy, App::instance()->defaultVisual(screen), 1, XYBitmap, 0, |
273 | (char *)bitdata, bit_w, bit_h, 8, 0); | 273 | (char *)bitdata, bit_w, bit_h, 8, 0); |
274 | 274 | ||
275 | if (I2 == None) { | 275 | if (I2 == None) { |
diff --git a/src/FbTk/XftFontImp.cc b/src/FbTk/XftFontImp.cc index 80eb2c4..fe5b8e6 100644 --- a/src/FbTk/XftFontImp.cc +++ b/src/FbTk/XftFontImp.cc | |||
@@ -102,8 +102,8 @@ void XftFontImp::drawText(const FbDrawable &w, int screen, GC gc, const FbString | |||
102 | 102 | ||
103 | XftDraw *draw = XftDrawCreate(w.display(), | 103 | XftDraw *draw = XftDrawCreate(w.display(), |
104 | w.drawable(), | 104 | w.drawable(), |
105 | DefaultVisual(w.display(), screen), | 105 | App::instance()->defaultVisual(screen), |
106 | DefaultColormap(w.display(), screen)); | 106 | App::instance()->defaultColormap(screen)); |
107 | 107 | ||
108 | XGCValues gc_val; | 108 | XGCValues gc_val; |
109 | 109 | ||
@@ -114,7 +114,7 @@ void XftFontImp::drawText(const FbDrawable &w, int screen, GC gc, const FbString | |||
114 | // get red, green, blue values | 114 | // get red, green, blue values |
115 | XColor xcol; | 115 | XColor xcol; |
116 | xcol.pixel = gc_val.foreground; | 116 | xcol.pixel = gc_val.foreground; |
117 | XQueryColor(w.display(), DefaultColormap(w.display(), screen), &xcol); | 117 | XQueryColor(w.display(), App::instance()->defaultColormap(screen), &xcol); |
118 | 118 | ||
119 | // convert xcolor to XftColor | 119 | // convert xcolor to XftColor |
120 | XRenderColor rendcol; | 120 | XRenderColor rendcol; |
@@ -124,8 +124,8 @@ void XftFontImp::drawText(const FbDrawable &w, int screen, GC gc, const FbString | |||
124 | rendcol.alpha = 0xFFFF; | 124 | rendcol.alpha = 0xFFFF; |
125 | XftColor xftcolor; | 125 | XftColor xftcolor; |
126 | XftColorAllocValue(w.display(), | 126 | XftColorAllocValue(w.display(), |
127 | DefaultVisual(w.display(), screen), | 127 | App::instance()->defaultVisual(screen), |
128 | DefaultColormap(w.display(), screen), | 128 | App::instance()->defaultColormap(screen), |
129 | &rendcol, &xftcolor); | 129 | &rendcol, &xftcolor); |
130 | 130 | ||
131 | // draw string | 131 | // draw string |
@@ -145,8 +145,8 @@ void XftFontImp::drawText(const FbDrawable &w, int screen, GC gc, const FbString | |||
145 | x, y, | 145 | x, y, |
146 | (XftChar8 *)(text.data()), len); | 146 | (XftChar8 *)(text.data()), len); |
147 | XftColorFree(w.display(), | 147 | XftColorFree(w.display(), |
148 | DefaultVisual(w.display(), screen), | 148 | App::instance()->defaultVisual(screen), |
149 | DefaultColormap(w.display(), screen), &xftcolor); | 149 | App::instance()->defaultColormap(screen), &xftcolor); |
150 | XftDrawDestroy(draw); | 150 | XftDrawDestroy(draw); |
151 | return; | 151 | return; |
152 | } | 152 | } |
@@ -161,8 +161,8 @@ void XftFontImp::drawText(const FbDrawable &w, int screen, GC gc, const FbString | |||
161 | 161 | ||
162 | 162 | ||
163 | XftColorFree(w.display(), | 163 | XftColorFree(w.display(), |
164 | DefaultVisual(w.display(), screen), | 164 | App::instance()->defaultVisual(screen), |
165 | DefaultColormap(w.display(), screen), &xftcolor); | 165 | App::instance()->defaultColormap(screen), &xftcolor); |
166 | XftDrawDestroy(draw); | 166 | XftDrawDestroy(draw); |
167 | } | 167 | } |
168 | 168 | ||
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index 2975252..c7763f8 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc | |||
@@ -51,7 +51,10 @@ FbWinFrame::FbWinFrame(BScreen &screen, WindowState &state, | |||
51 | m_window(theme->screenNum(), state.x, state.y, state.width, state.height, | 51 | m_window(theme->screenNum(), state.x, state.y, state.width, state.height, |
52 | ButtonPressMask | ButtonReleaseMask | | 52 | ButtonPressMask | ButtonReleaseMask | |
53 | ButtonMotionMask | EnterWindowMask | | 53 | ButtonMotionMask | EnterWindowMask | |
54 | LeaveWindowMask, true), | 54 | LeaveWindowMask, |
55 | screen.rootWindow().visual(), | ||
56 | screen.rootWindow().colormap(), screen.rootWindow().depth(), | ||
57 | true, false), | ||
55 | m_layeritem(window(), *screen.layerManager().getLayer(Layer::NORMAL)), | 58 | m_layeritem(window(), *screen.layerManager().getLayer(Layer::NORMAL)), |
56 | m_titlebar(m_window, 0, 0, 100, 16, | 59 | m_titlebar(m_window, 0, 0, 100, 16, |
57 | ButtonPressMask | ButtonReleaseMask | | 60 | ButtonPressMask | ButtonReleaseMask | |
diff --git a/src/IconButton.cc b/src/IconButton.cc index d63f6da..a1d7efa 100644 --- a/src/IconButton.cc +++ b/src/IconButton.cc | |||
@@ -202,7 +202,7 @@ void IconButton::update(FbTk::Subject *subj) { | |||
202 | m_icon_window.moveResize(iconx, icony, neww, newh); | 202 | m_icon_window.moveResize(iconx, icony, neww, newh); |
203 | 203 | ||
204 | m_icon_pixmap.copy(m_win.icon().pixmap().drawable(), | 204 | m_icon_pixmap.copy(m_win.icon().pixmap().drawable(), |
205 | DefaultDepth(display, screen), screen); | 205 | FbTk::App::instance()->defaultDepth(screen), screen); |
206 | m_icon_pixmap.scale(m_icon_window.width(), m_icon_window.height()); | 206 | m_icon_pixmap.scale(m_icon_window.width(), m_icon_window.height()); |
207 | 207 | ||
208 | // rotate the icon or not?? lets go not for now, and see what they say... | 208 | // rotate the icon or not?? lets go not for now, and see what they say... |
diff --git a/src/Screen.cc b/src/Screen.cc index 8b605e7..416b6be 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -335,8 +335,8 @@ BScreen::BScreen(FbTk::ResourceManager &rm, | |||
335 | m_geom_window(new OSDWindow(m_root_window, *this, *m_focused_windowtheme)), | 335 | m_geom_window(new OSDWindow(m_root_window, *this, *m_focused_windowtheme)), |
336 | m_pos_window(new OSDWindow(m_root_window, *this, *m_focused_windowtheme)), | 336 | m_pos_window(new OSDWindow(m_root_window, *this, *m_focused_windowtheme)), |
337 | m_tooltip_window(new TooltipWindow(m_root_window, *this, *m_focused_windowtheme)), | 337 | m_tooltip_window(new TooltipWindow(m_root_window, *this, *m_focused_windowtheme)), |
338 | m_dummy_window(scrn, -1, -1, 1, 1, 0, true, false, CopyFromParent, | 338 | m_dummy_window(scrn, -1, -1, 1, 1, 0, CopyFromParent, 0, CopyFromParent, |
339 | InputOnly), | 339 | true, false, InputOnly), |
340 | resource(rm, screenname, altscreenname), | 340 | resource(rm, screenname, altscreenname), |
341 | m_resource_manager(rm), | 341 | m_resource_manager(rm), |
342 | m_name(screenname), | 342 | m_name(screenname), |
diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 96d2701..30ca9a0 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc | |||
@@ -187,7 +187,7 @@ Toolbar::Frame::Frame(FbTk::EventHandler &evh, int screen_num): | |||
187 | // event mask | 187 | // event mask |
188 | ButtonPressMask | ButtonReleaseMask | ExposureMask | | 188 | ButtonPressMask | ButtonReleaseMask | ExposureMask | |
189 | EnterWindowMask | LeaveWindowMask | SubstructureNotifyMask, | 189 | EnterWindowMask | LeaveWindowMask | SubstructureNotifyMask, |
190 | 190 | CopyFromParent, 0, CopyFromParent, | |
191 | true) // override redirect | 191 | true) // override redirect |
192 | { | 192 | { |
193 | 193 | ||
diff --git a/src/WinButton.cc b/src/WinButton.cc index d64034e..d570758 100644 --- a/src/WinButton.cc +++ b/src/WinButton.cc | |||
@@ -284,11 +284,10 @@ void WinButton::update(FbTk::Subject *subj) { | |||
284 | // update the menu icon | 284 | // update the menu icon |
285 | if (m_type == MENUICON && !m_listen_to.empty()) { | 285 | if (m_type == MENUICON && !m_listen_to.empty()) { |
286 | 286 | ||
287 | Display* display = m_listen_to.fbWindow().display(); | ||
288 | int screen = m_listen_to.screen().screenNumber(); | 287 | int screen = m_listen_to.screen().screenNumber(); |
289 | if (m_listen_to.icon().pixmap().drawable() != None) { | 288 | if (m_listen_to.icon().pixmap().drawable() != None) { |
290 | m_icon_pixmap.copy(m_listen_to.icon().pixmap().drawable(), | 289 | m_icon_pixmap.copy(m_listen_to.icon().pixmap().drawable(), |
291 | DefaultDepth(display, screen), screen); | 290 | FbTk::App::instance()->defaultDepth(screen), screen); |
292 | m_icon_pixmap.scale(width() - 4, height() - 4); | 291 | m_icon_pixmap.scale(width() - 4, height() - 4); |
293 | } else | 292 | } else |
294 | m_icon_pixmap.release(); | 293 | m_icon_pixmap.release(); |
diff --git a/src/WinClient.cc b/src/WinClient.cc index 3a22e4a..c64f5d8 100644 --- a/src/WinClient.cc +++ b/src/WinClient.cc | |||
@@ -107,6 +107,12 @@ WinClient::WinClient(Window win, BScreen &screen, FluxboxWindow *fbwin): | |||
107 | // this needs to be done before creating an fbwindow, so this doesn't get | 107 | // this needs to be done before creating an fbwindow, so this doesn't get |
108 | // tabbed using the apps file | 108 | // tabbed using the apps file |
109 | updateTransientInfo(); | 109 | updateTransientInfo(); |
110 | |||
111 | // Record the visual | ||
112 | XWindowAttributes a; | ||
113 | XGetWindowAttributes(display(), win, &a); | ||
114 | m_visual = a.visual; | ||
115 | printf("WinClient: Client visual is 0x%02x\n", (unsigned)XVisualIDFromVisual(m_visual)); | ||
110 | } | 116 | } |
111 | 117 | ||
112 | WinClient::~WinClient() { | 118 | WinClient::~WinClient() { |
diff --git a/src/WinClient.hh b/src/WinClient.hh index 90c5b14..d589dd0 100644 --- a/src/WinClient.hh +++ b/src/WinClient.hh | |||
@@ -126,6 +126,8 @@ public: | |||
126 | 126 | ||
127 | static const int PropMwmHintsElements = 3; | 127 | static const int PropMwmHintsElements = 3; |
128 | 128 | ||
129 | Visual* visual() const { return m_visual; } | ||
130 | |||
129 | /** | 131 | /** |
130 | !! TODO !! | 132 | !! TODO !! |
131 | remove or move these to private | 133 | remove or move these to private |
@@ -155,6 +157,7 @@ private: | |||
155 | 157 | ||
156 | bool m_title_override; | 158 | bool m_title_override; |
157 | bool m_icon_override; | 159 | bool m_icon_override; |
160 | Visual *m_visual; | ||
158 | 161 | ||
159 | WindowState::WindowType m_window_type; | 162 | WindowState::WindowType m_window_type; |
160 | MwmHints *m_mwm_hint; | 163 | MwmHints *m_mwm_hint; |
diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 93768da..580bc4c 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc | |||
@@ -169,6 +169,9 @@ int handleXErrors(Display *d, XErrorEvent *e) { | |||
169 | (int)e->request_code<<"/"<<(int)e->minor_code<<" resource 0x"<<hex<<(int)e->resourceid<<dec<<endl; | 169 | (int)e->request_code<<"/"<<(int)e->minor_code<<" resource 0x"<<hex<<(int)e->resourceid<<dec<<endl; |
170 | // if (e->error_code != 9 && e->error_code != 183) | 170 | // if (e->error_code != 9 && e->error_code != 183) |
171 | // kill(0, 2); | 171 | // kill(0, 2); |
172 | if (e->error_code == BadDrawable) { | ||
173 | kill(0,2); | ||
174 | } | ||
172 | } | 175 | } |
173 | #endif // !DEBUG | 176 | #endif // !DEBUG |
174 | 177 | ||