aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorakir <akir>2004-09-09 14:29:10 (GMT)
committerakir <akir>2004-09-09 14:29:10 (GMT)
commit1d355a91925536ba2b4f0ffe652cb72540c91000 (patch)
treee323adb7f34038f1cdcd9c773339bb7ab679641f /src
parent7507098440e300c0126affbdd469456653b41e95 (diff)
downloadfluxbox-1d355a91925536ba2b4f0ffe652cb72540c91000.zip
fluxbox-1d355a91925536ba2b4f0ffe652cb72540c91000.tar.bz2
transfered ::getRootPixmap from several places to new home, FbPixmap
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/FbPixmap.cc41
-rw-r--r--src/FbTk/FbPixmap.hh3
-rw-r--r--src/FbTk/FbWindow.cc32
-rw-r--r--src/FbTk/Menu.cc29
-rw-r--r--src/Screen.cc44
-rw-r--r--src/Screen.hh3
6 files changed, 62 insertions, 90 deletions
diff --git a/src/FbTk/FbPixmap.cc b/src/FbTk/FbPixmap.cc
index bbc1906..c698ce6 100644
--- a/src/FbTk/FbPixmap.cc
+++ b/src/FbTk/FbPixmap.cc
@@ -19,13 +19,14 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: FbPixmap.cc,v 1.12 2004/07/06 10:47:36 fluxgen Exp $ 22// $Id: FbPixmap.cc,v 1.13 2004/09/09 14:29:10 akir Exp $
23 23
24#include "FbPixmap.hh" 24#include "FbPixmap.hh"
25#include "App.hh" 25#include "App.hh"
26#include "GContext.hh" 26#include "GContext.hh"
27 27
28#include <X11/Xutil.h> 28#include <X11/Xutil.h>
29#include <X11/Xatom.h>
29#include <iostream> 30#include <iostream>
30using namespace std; 31using namespace std;
31 32
@@ -203,6 +204,7 @@ void FbPixmap::rotate() {
203} 204}
204 205
205void FbPixmap::scale(unsigned int dest_width, unsigned int dest_height) { 206void FbPixmap::scale(unsigned int dest_width, unsigned int dest_height) {
207
206 if (drawable() == 0 || 208 if (drawable() == 0 ||
207 (dest_width == width() && dest_height == height())) 209 (dest_width == width() && dest_height == height()))
208 return; 210 return;
@@ -284,6 +286,43 @@ Pixmap FbPixmap::release() {
284 return ret; 286 return ret;
285} 287}
286 288
289Pixmap FbPixmap::getRootPixmap(int screen_num) {
290
291 Pixmap root_pm = 0;
292 // get root pixmap for transparency
293 Display *disp = FbTk::App::instance()->display();
294 Atom real_type;
295 int real_format;
296 unsigned long items_read, items_left;
297 unsigned int *data;
298 if (XGetWindowProperty(disp, RootWindow(disp, screen_num),
299 XInternAtom(disp, "_XROOTPMAP_ID", false),
300 0L, 1L,
301 false, XA_PIXMAP, &real_type,
302 &real_format, &items_read, &items_left,
303 (unsigned char **) &data) == Success &&
304 items_read) {
305 root_pm = (Pixmap) (*data);
306 XFree(data);
307/* TODO: analyze why this doesnt work
308 } else if (XGetWindowProperty(disp, RootWindow(disp, screen_num),
309 XInternAtom(disp, "_XSETROOT_ID", false),
310 0L, 1L,
311 false, XA_PIXMAP, &real_type,
312 &real_format, &items_read, &items_left,
313 (unsigned char **) &data) == Success &&
314 items_read) {
315 root_pm = (Pixmap) (*data);
316 XFree(data);
317*/
318 }
319
320
321 return root_pm;
322
323
324}
325
287void FbPixmap::free() { 326void FbPixmap::free() {
288 if (m_pm != 0) { 327 if (m_pm != 0) {
289 XFreePixmap(FbTk::App::instance()->display(), m_pm); 328 XFreePixmap(FbTk::App::instance()->display(), m_pm);
diff --git a/src/FbTk/FbPixmap.hh b/src/FbTk/FbPixmap.hh
index 77dc555..ee5d6ac 100644
--- a/src/FbTk/FbPixmap.hh
+++ b/src/FbTk/FbPixmap.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: FbPixmap.hh,v 1.12 2004/07/05 23:51:57 fluxgen Exp $ 22// $Id: FbPixmap.hh,v 1.13 2004/09/09 14:29:10 akir Exp $
23 23
24#ifndef FBTK_FBPIXMAP_HH 24#ifndef FBTK_FBPIXMAP_HH
25#define FBTK_FBPIXMAP_HH 25#define FBTK_FBPIXMAP_HH
@@ -68,6 +68,7 @@ public:
68 inline unsigned int height() const { return m_height; } 68 inline unsigned int height() const { return m_height; }
69 inline int depth() const { return m_depth; } 69 inline int depth() const { return m_depth; }
70 70
71 static Pixmap getRootPixmap(int screen_num);
71 72
72private: 73private:
73 void free(); 74 void free();
diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc
index 2209835..5417c09 100644
--- a/src/FbTk/FbWindow.cc
+++ b/src/FbTk/FbWindow.cc
@@ -19,9 +19,10 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: FbWindow.cc,v 1.37 2004/08/31 15:26:39 rathnor Exp $ 22// $Id: FbWindow.cc,v 1.38 2004/09/09 14:29:10 akir Exp $
23 23
24#include "FbWindow.hh" 24#include "FbWindow.hh"
25#include "FbPixmap.hh"
25 26
26#include "EventManager.hh" 27#include "EventManager.hh"
27#include "Color.hh" 28#include "Color.hh"
@@ -43,31 +44,6 @@
43 44
44namespace FbTk { 45namespace FbTk {
45 46
46namespace {
47Pixmap getRootPixmap(int screen_num) {
48 Pixmap root_pm = 0;
49 // get root pixmap for transparency
50 Display *disp = FbTk::App::instance()->display();
51 Atom real_type;
52 int real_format;
53 unsigned long items_read, items_left;
54 unsigned int *data;
55 if (XGetWindowProperty(disp, RootWindow(disp, screen_num),
56 XInternAtom(disp, "_XROOTPMAP_ID", false),
57 0L, 1L,
58 false, XA_PIXMAP, &real_type,
59 &real_format, &items_read, &items_left,
60 (unsigned char **) &data) == Success &&
61 items_read) {
62 root_pm = (Pixmap) (*data);
63 XFree(data);
64 }
65
66 return root_pm;
67}
68
69}; // end anonymous namespace
70
71Display *FbWindow::s_display = 0; 47Display *FbWindow::s_display = 0;
72 48
73FbWindow::FbWindow():m_parent(0), m_screen_num(0), m_window(0), m_x(0), m_y(0), 49FbWindow::FbWindow():m_parent(0), m_screen_num(0), m_window(0), m_x(0), m_y(0),
@@ -207,7 +183,7 @@ void FbWindow::updateTransparent(int the_x, int the_y, unsigned int the_width, u
207 return; 183 return;
208 184
209 // update source and destination if needed 185 // update source and destination if needed
210 Pixmap root = getRootPixmap(screenNumber()); 186 Pixmap root = FbPixmap::getRootPixmap(screenNumber());
211 if (m_transparent->source() != root) 187 if (m_transparent->source() != root)
212 m_transparent->setSource(root, screenNumber()); 188 m_transparent->setSource(root, screenNumber());
213 189
@@ -245,7 +221,7 @@ void FbWindow::updateTransparent(int the_x, int the_y, unsigned int the_width, u
245void FbWindow::setAlpha(unsigned char alpha) { 221void FbWindow::setAlpha(unsigned char alpha) {
246#ifdef HAVE_XRENDER 222#ifdef HAVE_XRENDER
247 if (m_transparent.get() == 0 && alpha < 255) { 223 if (m_transparent.get() == 0 && alpha < 255) {
248 m_transparent.reset(new Transparent(getRootPixmap(screenNumber()), window(), alpha, screenNumber())); 224 m_transparent.reset(new Transparent(FbPixmap::getRootPixmap(screenNumber()), window(), alpha, screenNumber()));
249 } else if (alpha < 255 && alpha != m_transparent->alpha()) 225 } else if (alpha < 255 && alpha != m_transparent->alpha())
250 m_transparent->setAlpha(alpha); 226 m_transparent->setAlpha(alpha);
251 else if (alpha == 255) 227 else if (alpha == 255)
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index b38ae73..a1fdf8c 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Menu.cc,v 1.79 2004/08/31 15:26:39 rathnor Exp $ 25// $Id: Menu.cc,v 1.80 2004/09/09 14:29:10 akir Exp $
26 26
27//use GNU extensions 27//use GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -44,6 +44,7 @@
44#include "Transparent.hh" 44#include "Transparent.hh"
45#include "SimpleCommand.hh" 45#include "SimpleCommand.hh"
46#include "I18n.hh" 46#include "I18n.hh"
47#include "FbPixmap.hh"
47 48
48#include <X11/Xatom.h> 49#include <X11/Xatom.h>
49#include <X11/keysym.h> 50#include <X11/keysym.h>
@@ -74,28 +75,6 @@ static Menu *shown = 0;
74 75
75Menu *Menu::s_focused = 0; 76Menu *Menu::s_focused = 0;
76 77
77static Pixmap getRootPixmap(int screen_num) {
78 Pixmap root_pm = 0;
79 // get root pixmap for transparency
80 Display *disp = FbTk::App::instance()->display();
81 Atom real_type;
82 int real_format;
83 unsigned long items_read, items_left;
84 unsigned int *data;
85 if (XGetWindowProperty(disp, RootWindow(disp, screen_num),
86 XInternAtom(disp, "_XROOTPMAP_ID", false),
87 0L, 1L,
88 false, XA_PIXMAP, &real_type,
89 &real_format, &items_read, &items_left,
90 (unsigned char **) &data) == Success &&
91 items_read) {
92 root_pm = (Pixmap) (*data);
93 XFree(data);
94 }
95
96 return root_pm;
97}
98
99Menu::Menu(MenuTheme &tm, ImageControl &imgctrl): 78Menu::Menu(MenuTheme &tm, ImageControl &imgctrl):
100 m_theme(tm), 79 m_theme(tm),
101 m_parent(0), 80 m_parent(0),
@@ -1406,7 +1385,7 @@ void Menu::reconfigure() {
1406 } else if (alpha () < 255) { 1385 } else if (alpha () < 255) {
1407 1386
1408 if (m_transp.get() == 0) { 1387 if (m_transp.get() == 0) {
1409 m_transp.reset(new Transparent(getRootPixmap(screenNumber()), 1388 m_transp.reset(new Transparent(FbPixmap::getRootPixmap(screenNumber()),
1410 m_real_frame_pm.drawable(), alpha(), 1389 m_real_frame_pm.drawable(), alpha(),
1411 screenNumber())); 1390 screenNumber()));
1412 } else 1391 } else
@@ -1497,7 +1476,7 @@ void Menu::renderTransp(int x, int y,
1497 // render the root background 1476 // render the root background
1498#ifdef HAVE_XRENDER 1477#ifdef HAVE_XRENDER
1499 1478
1500 Pixmap root = getRootPixmap(screenNumber()); 1479 Pixmap root = FbPixmap::getRootPixmap(screenNumber());
1501 if (m_transp->source() != root) 1480 if (m_transp->source() != root)
1502 m_transp->setSource(root, screenNumber()); 1481 m_transp->setSource(root, screenNumber());
1503 1482
diff --git a/src/Screen.cc b/src/Screen.cc
index 67e954b..8372f0f 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Screen.cc,v 1.288 2004/09/06 13:17:56 akir Exp $ 25// $Id: Screen.cc,v 1.289 2004/09/09 14:29:03 akir Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -231,7 +231,8 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
231 m_shutdown(false) { 231 m_shutdown(false) {
232 232
233 233
234 Display *disp = FbTk::App::instance()->display(); 234 Fluxbox *fluxbox = Fluxbox::instance();
235 Display *disp = fluxbox->display();
235 236
236 initXinerama(); 237 initXinerama();
237 238
@@ -242,7 +243,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
242 SubstructureRedirectMask | KeyPressMask | KeyReleaseMask | 243 SubstructureRedirectMask | KeyPressMask | KeyReleaseMask |
243 ButtonPressMask | ButtonReleaseMask| SubstructureNotifyMask); 244 ButtonPressMask | ButtonReleaseMask| SubstructureNotifyMask);
244 245
245 FbTk::App::instance()->sync(false); 246 fluxbox->sync(false);
246 247
247 XSetErrorHandler((XErrorHandler) old); 248 XSetErrorHandler((XErrorHandler) old);
248 249
@@ -263,7 +264,6 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
263 264
264 rootWindow().setCursor(XCreateFontCursor(disp, XC_left_ptr)); 265 rootWindow().setCursor(XCreateFontCursor(disp, XC_left_ptr));
265 266
266 Fluxbox *fluxbox = Fluxbox::instance();
267 // load this screens resources 267 // load this screens resources
268 fluxbox->load_rc(*this); 268 fluxbox->load_rc(*this);
269 269
@@ -378,7 +378,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
378 // So we lock root theme temporary so it doesn't uses RootTheme::reconfigTheme 378 // So we lock root theme temporary so it doesn't uses RootTheme::reconfigTheme
379 // This must be fixed in the future. 379 // This must be fixed in the future.
380 m_root_theme->lock(true); 380 m_root_theme->lock(true);
381 FbTk::ThemeManager::instance().load(Fluxbox::instance()->getStyleFilename()); 381 FbTk::ThemeManager::instance().load(fluxbox->getStyleFilename());
382 m_root_theme->lock(false); 382 m_root_theme->lock(false);
383 m_root_theme->setLineAttributes(*resource.gc_line_width, 383 m_root_theme->setLineAttributes(*resource.gc_line_width,
384 *resource.gc_line_style, 384 *resource.gc_line_style,
@@ -386,8 +386,8 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
386 *resource.gc_join_style); 386 *resource.gc_join_style);
387 387
388#ifdef SLIT 388#ifdef SLIT
389 m_slit.reset(new Slit(*this, *layerManager().getLayer(Fluxbox::instance()->getDesktopLayer()), 389 m_slit.reset(new Slit(*this, *layerManager().getLayer(fluxbox->getDesktopLayer()),
390 Fluxbox::instance()->getSlitlistFilename().c_str())); 390 fluxbox->getSlitlistFilename().c_str()));
391#endif // SLIT 391#endif // SLIT
392 392
393 rm.unlock(); 393 rm.unlock();
@@ -445,7 +445,7 @@ void BScreen::initWindows() {
445 Fluxbox *fluxbox = Fluxbox::instance(); 445 Fluxbox *fluxbox = Fluxbox::instance();
446 446
447 // preen the window list of all icon windows... for better dockapp support 447 // preen the window list of all icon windows... for better dockapp support
448 for (int i = 0; i < (int) nchild; i++) { 448 for (unsigned int i = 0; i < nchild; i++) {
449 449
450 if (children[i] == None) 450 if (children[i] == None)
451 continue; 451 continue;
@@ -455,7 +455,7 @@ void BScreen::initWindows() {
455 if (wmhints) { 455 if (wmhints) {
456 if ((wmhints->flags & IconWindowHint) && 456 if ((wmhints->flags & IconWindowHint) &&
457 (wmhints->icon_window != children[i])) 457 (wmhints->icon_window != children[i]))
458 for (int j = 0; j < (int) nchild; j++) { 458 for (unsigned int j = 0; j < nchild; j++) {
459 if (children[j] == wmhints->icon_window) { 459 if (children[j] == wmhints->icon_window) {
460#ifdef DEBUG 460#ifdef DEBUG
461 cerr<<"BScreen::initWindows(): children[j] = 0x"<<hex<<children[j]<<dec<<endl; 461 cerr<<"BScreen::initWindows(): children[j] = 0x"<<hex<<children[j]<<dec<<endl;
@@ -474,7 +474,7 @@ void BScreen::initWindows() {
474 // complexity: O(n^2) if we have lots of transients to transient_for 474 // complexity: O(n^2) if we have lots of transients to transient_for
475 // but usually O(n) 475 // but usually O(n)
476 Window transient_for = 0; 476 Window transient_for = 0;
477 for (int i = 0; i < (int) nchild; ++i) { 477 for (unsigned int i = 0; i < nchild; ++i) {
478 if (children[i] == None) 478 if (children[i] == None)
479 continue; 479 continue;
480 else if (!fluxbox->validateWindow(children[i])) { 480 else if (!fluxbox->validateWindow(children[i])) {
@@ -493,7 +493,7 @@ void BScreen::initWindows() {
493 fluxbox->searchWindow(transient_for) == 0) { 493 fluxbox->searchWindow(transient_for) == 0) {
494 // search forward for transient_for 494 // search forward for transient_for
495 // and swap place with it so it gets created first 495 // and swap place with it so it gets created first
496 int j = i + 1; 496 unsigned int j = i + 1;
497 for (; j < nchild; ++j) { 497 for (; j < nchild; ++j) {
498 if (children[j] == transient_for) { 498 if (children[j] == transient_for) {
499 swap(children[i], children[j]); 499 swap(children[i], children[j]);
@@ -548,28 +548,6 @@ unsigned int BScreen::currentWorkspaceID() const {
548 return m_current_workspace->workspaceID(); 548 return m_current_workspace->workspaceID();
549} 549}
550 550
551Pixmap BScreen::rootPixmap() const {
552
553 Pixmap root_pm = 0;
554 Display *disp = FbTk::App::instance()->display();
555 Atom real_type;
556 int real_format;
557 unsigned long items_read, items_left;
558 unsigned int *data;
559 if (rootWindow().property(XInternAtom(disp, "_XROOTPMAP_ID", false),
560 0L, 1L,
561 false, XA_PIXMAP, &real_type,
562 &real_format, &items_read, &items_left,
563 (unsigned char **) &data) &&
564 items_read) {
565 root_pm = (Pixmap) (*data);
566 XFree(data);
567 }
568
569 return root_pm;
570
571}
572
573unsigned int BScreen::maxLeft(int head) const { 551unsigned int BScreen::maxLeft(int head) const {
574 // we ignore strut if we're doing full maximization 552 // we ignore strut if we're doing full maximization
575 if (hasXinerama()) 553 if (hasXinerama())
diff --git a/src/Screen.hh b/src/Screen.hh
index b81110f..076ee63 100644
--- a/src/Screen.hh
+++ b/src/Screen.hh
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Screen.hh,v 1.143 2004/08/31 15:26:38 rathnor Exp $ 25// $Id: Screen.hh,v 1.144 2004/09/09 14:29:04 akir Exp $
26 26
27#ifndef SCREEN_HH 27#ifndef SCREEN_HH
28#define SCREEN_HH 28#define SCREEN_HH
@@ -137,7 +137,6 @@ public:
137 137
138 138
139 unsigned int currentWorkspaceID() const; 139 unsigned int currentWorkspaceID() const;
140 Pixmap rootPixmap() const;
141 /* 140 /*
142 maximum screen bounds for given window 141 maximum screen bounds for given window
143 */ 142 */