all repos — fluxbox @ 1d355a91925536ba2b4f0ffe652cb72540c91000

custom fork of the fluxbox windowmanager

transfered ::getRootPixmap from several places to new home, FbPixmap
akir akir
commit

1d355a91925536ba2b4f0ffe652cb72540c91000

parent

7507098440e300c0126affbdd469456653b41e95

M src/FbTk/FbPixmap.ccsrc/FbTk/FbPixmap.cc

@@ -19,13 +19,14 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbPixmap.cc,v 1.12 2004/07/06 10:47:36 fluxgen Exp $ +// $Id: FbPixmap.cc,v 1.13 2004/09/09 14:29:10 akir Exp $ #include "FbPixmap.hh" #include "App.hh" #include "GContext.hh" #include <X11/Xutil.h> +#include <X11/Xatom.h> #include <iostream> using namespace std;

@@ -203,6 +204,7 @@ m_pm = new_pm.release();

} void FbPixmap::scale(unsigned int dest_width, unsigned int dest_height) { + if (drawable() == 0 || (dest_width == width() && dest_height == height())) return;

@@ -282,6 +284,43 @@ m_width = 0;

m_height = 0; m_depth = 0; return ret; +} + +Pixmap FbPixmap::getRootPixmap(int screen_num) { + + Pixmap root_pm = 0; + // get root pixmap for transparency + Display *disp = FbTk::App::instance()->display(); + Atom real_type; + int real_format; + unsigned long items_read, items_left; + unsigned int *data; + if (XGetWindowProperty(disp, RootWindow(disp, screen_num), + XInternAtom(disp, "_XROOTPMAP_ID", false), + 0L, 1L, + false, XA_PIXMAP, &real_type, + &real_format, &items_read, &items_left, + (unsigned char **) &data) == Success && + items_read) { + root_pm = (Pixmap) (*data); + XFree(data); +/* TODO: analyze why this doesnt work + } else if (XGetWindowProperty(disp, RootWindow(disp, screen_num), + XInternAtom(disp, "_XSETROOT_ID", false), + 0L, 1L, + false, XA_PIXMAP, &real_type, + &real_format, &items_read, &items_left, + (unsigned char **) &data) == Success && + items_read) { + root_pm = (Pixmap) (*data); + XFree(data); +*/ + } + + + return root_pm; + + } void FbPixmap::free() {
M src/FbTk/FbPixmap.hhsrc/FbTk/FbPixmap.hh

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbPixmap.hh,v 1.12 2004/07/05 23:51:57 fluxgen Exp $ +// $Id: FbPixmap.hh,v 1.13 2004/09/09 14:29:10 akir Exp $ #ifndef FBTK_FBPIXMAP_HH #define FBTK_FBPIXMAP_HH

@@ -68,6 +68,7 @@ inline unsigned int width() const { return m_width; }

inline unsigned int height() const { return m_height; } inline int depth() const { return m_depth; } + static Pixmap getRootPixmap(int screen_num); private: void free();
M src/FbTk/FbWindow.ccsrc/FbTk/FbWindow.cc

@@ -19,9 +19,10 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbWindow.cc,v 1.37 2004/08/31 15:26:39 rathnor Exp $ +// $Id: FbWindow.cc,v 1.38 2004/09/09 14:29:10 akir Exp $ #include "FbWindow.hh" +#include "FbPixmap.hh" #include "EventManager.hh" #include "Color.hh"

@@ -42,31 +43,6 @@ #include <assert.h>

#endif namespace FbTk { - -namespace { -Pixmap getRootPixmap(int screen_num) { - Pixmap root_pm = 0; - // get root pixmap for transparency - Display *disp = FbTk::App::instance()->display(); - Atom real_type; - int real_format; - unsigned long items_read, items_left; - unsigned int *data; - if (XGetWindowProperty(disp, RootWindow(disp, screen_num), - XInternAtom(disp, "_XROOTPMAP_ID", false), - 0L, 1L, - false, XA_PIXMAP, &real_type, - &real_format, &items_read, &items_left, - (unsigned char **) &data) == Success && - items_read) { - root_pm = (Pixmap) (*data); - XFree(data); - } - - return root_pm; -} - -}; // end anonymous namespace Display *FbWindow::s_display = 0;

@@ -207,7 +183,7 @@ if (!m_transparent.get())

return; // update source and destination if needed - Pixmap root = getRootPixmap(screenNumber()); + Pixmap root = FbPixmap::getRootPixmap(screenNumber()); if (m_transparent->source() != root) m_transparent->setSource(root, screenNumber());

@@ -245,7 +221,7 @@

void FbWindow::setAlpha(unsigned char alpha) { #ifdef HAVE_XRENDER if (m_transparent.get() == 0 && alpha < 255) { - m_transparent.reset(new Transparent(getRootPixmap(screenNumber()), window(), alpha, screenNumber())); + m_transparent.reset(new Transparent(FbPixmap::getRootPixmap(screenNumber()), window(), alpha, screenNumber())); } else if (alpha < 255 && alpha != m_transparent->alpha()) m_transparent->setAlpha(alpha); else if (alpha == 255)
M src/FbTk/Menu.ccsrc/FbTk/Menu.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Menu.cc,v 1.79 2004/08/31 15:26:39 rathnor Exp $ +// $Id: Menu.cc,v 1.80 2004/09/09 14:29:10 akir Exp $ //use GNU extensions #ifndef _GNU_SOURCE

@@ -44,6 +44,7 @@ #include "EventManager.hh"

#include "Transparent.hh" #include "SimpleCommand.hh" #include "I18n.hh" +#include "FbPixmap.hh" #include <X11/Xatom.h> #include <X11/keysym.h>

@@ -73,28 +74,6 @@

static Menu *shown = 0; Menu *Menu::s_focused = 0; - -static Pixmap getRootPixmap(int screen_num) { - Pixmap root_pm = 0; - // get root pixmap for transparency - Display *disp = FbTk::App::instance()->display(); - Atom real_type; - int real_format; - unsigned long items_read, items_left; - unsigned int *data; - if (XGetWindowProperty(disp, RootWindow(disp, screen_num), - XInternAtom(disp, "_XROOTPMAP_ID", false), - 0L, 1L, - false, XA_PIXMAP, &real_type, - &real_format, &items_read, &items_left, - (unsigned char **) &data) == Success && - items_read) { - root_pm = (Pixmap) (*data); - XFree(data); - } - - return root_pm; -} Menu::Menu(MenuTheme &tm, ImageControl &imgctrl): m_theme(tm),

@@ -1406,7 +1385,7 @@ m_transp.reset(0);

} else if (alpha () < 255) { if (m_transp.get() == 0) { - m_transp.reset(new Transparent(getRootPixmap(screenNumber()), + m_transp.reset(new Transparent(FbPixmap::getRootPixmap(screenNumber()), m_real_frame_pm.drawable(), alpha(), screenNumber())); } else

@@ -1497,7 +1476,7 @@

// render the root background #ifdef HAVE_XRENDER - Pixmap root = getRootPixmap(screenNumber()); + Pixmap root = FbPixmap::getRootPixmap(screenNumber()); if (m_transp->source() != root) m_transp->setSource(root, screenNumber());
M src/Screen.ccsrc/Screen.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.cc,v 1.288 2004/09/06 13:17:56 akir Exp $ +// $Id: Screen.cc,v 1.289 2004/09/09 14:29:03 akir Exp $ #include "Screen.hh"

@@ -231,7 +231,8 @@ m_xinerama_headinfo(0),

m_shutdown(false) { - Display *disp = FbTk::App::instance()->display(); + Fluxbox *fluxbox = Fluxbox::instance(); + Display *disp = fluxbox->display(); initXinerama();

@@ -242,7 +243,7 @@ rootWindow().setEventMask(ColormapChangeMask | EnterWindowMask | PropertyChangeMask |

SubstructureRedirectMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask| SubstructureNotifyMask); - FbTk::App::instance()->sync(false); + fluxbox->sync(false); XSetErrorHandler((XErrorHandler) old);

@@ -263,7 +264,6 @@ cycling_window = focused_list.end();

rootWindow().setCursor(XCreateFontCursor(disp, XC_left_ptr)); - Fluxbox *fluxbox = Fluxbox::instance(); // load this screens resources fluxbox->load_rc(*this);

@@ -378,7 +378,7 @@ // else the focus label doesn't get updated

// So we lock root theme temporary so it doesn't uses RootTheme::reconfigTheme // This must be fixed in the future. m_root_theme->lock(true); - FbTk::ThemeManager::instance().load(Fluxbox::instance()->getStyleFilename()); + FbTk::ThemeManager::instance().load(fluxbox->getStyleFilename()); m_root_theme->lock(false); m_root_theme->setLineAttributes(*resource.gc_line_width, *resource.gc_line_style,

@@ -386,8 +386,8 @@ *resource.gc_cap_style,

*resource.gc_join_style); #ifdef SLIT - m_slit.reset(new Slit(*this, *layerManager().getLayer(Fluxbox::instance()->getDesktopLayer()), - Fluxbox::instance()->getSlitlistFilename().c_str())); + m_slit.reset(new Slit(*this, *layerManager().getLayer(fluxbox->getDesktopLayer()), + fluxbox->getSlitlistFilename().c_str())); #endif // SLIT rm.unlock();

@@ -445,7 +445,7 @@

Fluxbox *fluxbox = Fluxbox::instance(); // preen the window list of all icon windows... for better dockapp support - for (int i = 0; i < (int) nchild; i++) { + for (unsigned int i = 0; i < nchild; i++) { if (children[i] == None) continue;

@@ -455,7 +455,7 @@

if (wmhints) { if ((wmhints->flags & IconWindowHint) && (wmhints->icon_window != children[i])) - for (int j = 0; j < (int) nchild; j++) { + for (unsigned int j = 0; j < nchild; j++) { if (children[j] == wmhints->icon_window) { #ifdef DEBUG cerr<<"BScreen::initWindows(): children[j] = 0x"<<hex<<children[j]<<dec<<endl;

@@ -474,7 +474,7 @@ // manage shown windows

// complexity: O(n^2) if we have lots of transients to transient_for // but usually O(n) Window transient_for = 0; - for (int i = 0; i < (int) nchild; ++i) { + for (unsigned int i = 0; i < nchild; ++i) { if (children[i] == None) continue; else if (!fluxbox->validateWindow(children[i])) {

@@ -493,7 +493,7 @@ if (XGetTransientForHint(disp, children[i], &transient_for) &&

fluxbox->searchWindow(transient_for) == 0) { // search forward for transient_for // and swap place with it so it gets created first - int j = i + 1; + unsigned int j = i + 1; for (; j < nchild; ++j) { if (children[j] == transient_for) { swap(children[i], children[j]);

@@ -548,28 +548,6 @@ unsigned int BScreen::currentWorkspaceID() const {

return m_current_workspace->workspaceID(); } -Pixmap BScreen::rootPixmap() const { - - Pixmap root_pm = 0; - Display *disp = FbTk::App::instance()->display(); - Atom real_type; - int real_format; - unsigned long items_read, items_left; - unsigned int *data; - if (rootWindow().property(XInternAtom(disp, "_XROOTPMAP_ID", false), - 0L, 1L, - false, XA_PIXMAP, &real_type, - &real_format, &items_read, &items_left, - (unsigned char **) &data) && - items_read) { - root_pm = (Pixmap) (*data); - XFree(data); - } - - return root_pm; - -} - unsigned int BScreen::maxLeft(int head) const { // we ignore strut if we're doing full maximization if (hasXinerama())
M src/Screen.hhsrc/Screen.hh

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.hh,v 1.143 2004/08/31 15:26:38 rathnor Exp $ +// $Id: Screen.hh,v 1.144 2004/09/09 14:29:04 akir Exp $ #ifndef SCREEN_HH #define SCREEN_HH

@@ -137,7 +137,6 @@ FbTk::Menu &getWorkspacemenu() { return *m_workspacemenu.get(); }

unsigned int currentWorkspaceID() const; - Pixmap rootPixmap() const; /* maximum screen bounds for given window */