aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
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/FbTk
parent7507098440e300c0126affbdd469456653b41e95 (diff)
downloadfluxbox_paul-1d355a91925536ba2b4f0ffe652cb72540c91000.zip
fluxbox_paul-1d355a91925536ba2b4f0ffe652cb72540c91000.tar.bz2
transfered ::getRootPixmap from several places to new home, FbPixmap
Diffstat (limited to 'src/FbTk')
-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
4 files changed, 50 insertions, 55 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