transfered ::getRootPixmap from several places to new home, FbPixmap
This commit is contained in:
parent
7507098440
commit
1d355a9192
6 changed files with 62 additions and 90 deletions
|
@ -19,13 +19,14 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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 "FbPixmap.hh"
|
||||||
#include "App.hh"
|
#include "App.hh"
|
||||||
#include "GContext.hh"
|
#include "GContext.hh"
|
||||||
|
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
|
#include <X11/Xatom.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -203,6 +204,7 @@ void FbPixmap::rotate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FbPixmap::scale(unsigned int dest_width, unsigned int dest_height) {
|
void FbPixmap::scale(unsigned int dest_width, unsigned int dest_height) {
|
||||||
|
|
||||||
if (drawable() == 0 ||
|
if (drawable() == 0 ||
|
||||||
(dest_width == width() && dest_height == height()))
|
(dest_width == width() && dest_height == height()))
|
||||||
return;
|
return;
|
||||||
|
@ -284,6 +286,43 @@ Pixmap FbPixmap::release() {
|
||||||
return ret;
|
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() {
|
void FbPixmap::free() {
|
||||||
if (m_pm != 0) {
|
if (m_pm != 0) {
|
||||||
XFreePixmap(FbTk::App::instance()->display(), m_pm);
|
XFreePixmap(FbTk::App::instance()->display(), m_pm);
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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
|
#ifndef FBTK_FBPIXMAP_HH
|
||||||
#define FBTK_FBPIXMAP_HH
|
#define FBTK_FBPIXMAP_HH
|
||||||
|
@ -68,6 +68,7 @@ public:
|
||||||
inline unsigned int height() const { return m_height; }
|
inline unsigned int height() const { return m_height; }
|
||||||
inline int depth() const { return m_depth; }
|
inline int depth() const { return m_depth; }
|
||||||
|
|
||||||
|
static Pixmap getRootPixmap(int screen_num);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void free();
|
void free();
|
||||||
|
|
|
@ -19,9 +19,10 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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 "FbWindow.hh"
|
||||||
|
#include "FbPixmap.hh"
|
||||||
|
|
||||||
#include "EventManager.hh"
|
#include "EventManager.hh"
|
||||||
#include "Color.hh"
|
#include "Color.hh"
|
||||||
|
@ -43,31 +44,6 @@
|
||||||
|
|
||||||
namespace FbTk {
|
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;
|
Display *FbWindow::s_display = 0;
|
||||||
|
|
||||||
FbWindow::FbWindow():m_parent(0), m_screen_num(0), m_window(0), m_x(0), m_y(0),
|
FbWindow::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
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// update source and destination if needed
|
// update source and destination if needed
|
||||||
Pixmap root = getRootPixmap(screenNumber());
|
Pixmap root = FbPixmap::getRootPixmap(screenNumber());
|
||||||
if (m_transparent->source() != root)
|
if (m_transparent->source() != root)
|
||||||
m_transparent->setSource(root, screenNumber());
|
m_transparent->setSource(root, screenNumber());
|
||||||
|
|
||||||
|
@ -245,7 +221,7 @@ void FbWindow::updateTransparent(int the_x, int the_y, unsigned int the_width, u
|
||||||
void FbWindow::setAlpha(unsigned char alpha) {
|
void FbWindow::setAlpha(unsigned char alpha) {
|
||||||
#ifdef HAVE_XRENDER
|
#ifdef HAVE_XRENDER
|
||||||
if (m_transparent.get() == 0 && alpha < 255) {
|
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())
|
} else if (alpha < 255 && alpha != m_transparent->alpha())
|
||||||
m_transparent->setAlpha(alpha);
|
m_transparent->setAlpha(alpha);
|
||||||
else if (alpha == 255)
|
else if (alpha == 255)
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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
|
//use GNU extensions
|
||||||
#ifndef _GNU_SOURCE
|
#ifndef _GNU_SOURCE
|
||||||
|
@ -44,6 +44,7 @@
|
||||||
#include "Transparent.hh"
|
#include "Transparent.hh"
|
||||||
#include "SimpleCommand.hh"
|
#include "SimpleCommand.hh"
|
||||||
#include "I18n.hh"
|
#include "I18n.hh"
|
||||||
|
#include "FbPixmap.hh"
|
||||||
|
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
|
@ -74,28 +75,6 @@ static Menu *shown = 0;
|
||||||
|
|
||||||
Menu *Menu::s_focused = 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):
|
Menu::Menu(MenuTheme &tm, ImageControl &imgctrl):
|
||||||
m_theme(tm),
|
m_theme(tm),
|
||||||
m_parent(0),
|
m_parent(0),
|
||||||
|
@ -1406,7 +1385,7 @@ void Menu::reconfigure() {
|
||||||
} else if (alpha () < 255) {
|
} else if (alpha () < 255) {
|
||||||
|
|
||||||
if (m_transp.get() == 0) {
|
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(),
|
m_real_frame_pm.drawable(), alpha(),
|
||||||
screenNumber()));
|
screenNumber()));
|
||||||
} else
|
} else
|
||||||
|
@ -1497,7 +1476,7 @@ void Menu::renderTransp(int x, int y,
|
||||||
// render the root background
|
// render the root background
|
||||||
#ifdef HAVE_XRENDER
|
#ifdef HAVE_XRENDER
|
||||||
|
|
||||||
Pixmap root = getRootPixmap(screenNumber());
|
Pixmap root = FbPixmap::getRootPixmap(screenNumber());
|
||||||
if (m_transp->source() != root)
|
if (m_transp->source() != root)
|
||||||
m_transp->setSource(root, screenNumber());
|
m_transp->setSource(root, screenNumber());
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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"
|
#include "Screen.hh"
|
||||||
|
@ -231,7 +231,8 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
|
||||||
m_shutdown(false) {
|
m_shutdown(false) {
|
||||||
|
|
||||||
|
|
||||||
Display *disp = FbTk::App::instance()->display();
|
Fluxbox *fluxbox = Fluxbox::instance();
|
||||||
|
Display *disp = fluxbox->display();
|
||||||
|
|
||||||
initXinerama();
|
initXinerama();
|
||||||
|
|
||||||
|
@ -242,7 +243,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
|
||||||
SubstructureRedirectMask | KeyPressMask | KeyReleaseMask |
|
SubstructureRedirectMask | KeyPressMask | KeyReleaseMask |
|
||||||
ButtonPressMask | ButtonReleaseMask| SubstructureNotifyMask);
|
ButtonPressMask | ButtonReleaseMask| SubstructureNotifyMask);
|
||||||
|
|
||||||
FbTk::App::instance()->sync(false);
|
fluxbox->sync(false);
|
||||||
|
|
||||||
XSetErrorHandler((XErrorHandler) old);
|
XSetErrorHandler((XErrorHandler) old);
|
||||||
|
|
||||||
|
@ -263,7 +264,6 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
|
||||||
|
|
||||||
rootWindow().setCursor(XCreateFontCursor(disp, XC_left_ptr));
|
rootWindow().setCursor(XCreateFontCursor(disp, XC_left_ptr));
|
||||||
|
|
||||||
Fluxbox *fluxbox = Fluxbox::instance();
|
|
||||||
// load this screens resources
|
// load this screens resources
|
||||||
fluxbox->load_rc(*this);
|
fluxbox->load_rc(*this);
|
||||||
|
|
||||||
|
@ -378,7 +378,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
|
||||||
// So we lock root theme temporary so it doesn't uses RootTheme::reconfigTheme
|
// So we lock root theme temporary so it doesn't uses RootTheme::reconfigTheme
|
||||||
// This must be fixed in the future.
|
// This must be fixed in the future.
|
||||||
m_root_theme->lock(true);
|
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->lock(false);
|
||||||
m_root_theme->setLineAttributes(*resource.gc_line_width,
|
m_root_theme->setLineAttributes(*resource.gc_line_width,
|
||||||
*resource.gc_line_style,
|
*resource.gc_line_style,
|
||||||
|
@ -386,8 +386,8 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
|
||||||
*resource.gc_join_style);
|
*resource.gc_join_style);
|
||||||
|
|
||||||
#ifdef SLIT
|
#ifdef SLIT
|
||||||
m_slit.reset(new Slit(*this, *layerManager().getLayer(Fluxbox::instance()->getDesktopLayer()),
|
m_slit.reset(new Slit(*this, *layerManager().getLayer(fluxbox->getDesktopLayer()),
|
||||||
Fluxbox::instance()->getSlitlistFilename().c_str()));
|
fluxbox->getSlitlistFilename().c_str()));
|
||||||
#endif // SLIT
|
#endif // SLIT
|
||||||
|
|
||||||
rm.unlock();
|
rm.unlock();
|
||||||
|
@ -445,7 +445,7 @@ void BScreen::initWindows() {
|
||||||
Fluxbox *fluxbox = Fluxbox::instance();
|
Fluxbox *fluxbox = Fluxbox::instance();
|
||||||
|
|
||||||
// preen the window list of all icon windows... for better dockapp support
|
// 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)
|
if (children[i] == None)
|
||||||
continue;
|
continue;
|
||||||
|
@ -455,7 +455,7 @@ void BScreen::initWindows() {
|
||||||
if (wmhints) {
|
if (wmhints) {
|
||||||
if ((wmhints->flags & IconWindowHint) &&
|
if ((wmhints->flags & IconWindowHint) &&
|
||||||
(wmhints->icon_window != children[i]))
|
(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) {
|
if (children[j] == wmhints->icon_window) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
cerr<<"BScreen::initWindows(): children[j] = 0x"<<hex<<children[j]<<dec<<endl;
|
cerr<<"BScreen::initWindows(): children[j] = 0x"<<hex<<children[j]<<dec<<endl;
|
||||||
|
@ -474,7 +474,7 @@ void BScreen::initWindows() {
|
||||||
// complexity: O(n^2) if we have lots of transients to transient_for
|
// complexity: O(n^2) if we have lots of transients to transient_for
|
||||||
// but usually O(n)
|
// but usually O(n)
|
||||||
Window transient_for = 0;
|
Window transient_for = 0;
|
||||||
for (int i = 0; i < (int) nchild; ++i) {
|
for (unsigned int i = 0; i < nchild; ++i) {
|
||||||
if (children[i] == None)
|
if (children[i] == None)
|
||||||
continue;
|
continue;
|
||||||
else if (!fluxbox->validateWindow(children[i])) {
|
else if (!fluxbox->validateWindow(children[i])) {
|
||||||
|
@ -493,7 +493,7 @@ void BScreen::initWindows() {
|
||||||
fluxbox->searchWindow(transient_for) == 0) {
|
fluxbox->searchWindow(transient_for) == 0) {
|
||||||
// search forward for transient_for
|
// search forward for transient_for
|
||||||
// and swap place with it so it gets created first
|
// and swap place with it so it gets created first
|
||||||
int j = i + 1;
|
unsigned int j = i + 1;
|
||||||
for (; j < nchild; ++j) {
|
for (; j < nchild; ++j) {
|
||||||
if (children[j] == transient_for) {
|
if (children[j] == transient_for) {
|
||||||
swap(children[i], children[j]);
|
swap(children[i], children[j]);
|
||||||
|
@ -548,28 +548,6 @@ unsigned int BScreen::currentWorkspaceID() const {
|
||||||
return m_current_workspace->workspaceID();
|
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 {
|
unsigned int BScreen::maxLeft(int head) const {
|
||||||
// we ignore strut if we're doing full maximization
|
// we ignore strut if we're doing full maximization
|
||||||
if (hasXinerama())
|
if (hasXinerama())
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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
|
#ifndef SCREEN_HH
|
||||||
#define SCREEN_HH
|
#define SCREEN_HH
|
||||||
|
@ -137,7 +137,6 @@ public:
|
||||||
|
|
||||||
|
|
||||||
unsigned int currentWorkspaceID() const;
|
unsigned int currentWorkspaceID() const;
|
||||||
Pixmap rootPixmap() const;
|
|
||||||
/*
|
/*
|
||||||
maximum screen bounds for given window
|
maximum screen bounds for given window
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue