added XAtom class, and it all now compiles.
This commit is contained in:
parent
83347770a6
commit
a85c9a7c6e
6 changed files with 404 additions and 405 deletions
|
@ -121,11 +121,11 @@ static int handleXErrors(Display *d, XErrorEvent *e) {
|
|||
// signal handler to allow for proper and gentle shutdown
|
||||
|
||||
#ifndef HAVE_SIGACTION
|
||||
static RETSIGTYPE signalhandler(int sig) {
|
||||
static RETSIGTYPE signalhandler(int sig)
|
||||
#else // HAVE_SIGACTION
|
||||
static void signalhandler(int sig) {
|
||||
static void signalhandler(int sig)
|
||||
#endif // HAVE_SIGACTION
|
||||
|
||||
{
|
||||
static int re_enter = 0;
|
||||
|
||||
switch (sig) {
|
||||
|
@ -174,29 +174,29 @@ static RETSIGTYPE signalhandler(int sig) {
|
|||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// convenience functions
|
||||
// convenience functions
|
||||
#ifndef __EMX__
|
||||
void bexec(const char *command, char* displaystring) {
|
||||
void bexec(const char *command, char* displaystring) {
|
||||
if (! fork()) {
|
||||
setsid();
|
||||
putenv(displaystring);
|
||||
execl("/bin/sh", "/bin/sh", "-c", command, NULL);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !__EMX__
|
||||
|
||||
char *bstrdup(const char *s) {
|
||||
char *bstrdup(const char *s) {
|
||||
const int l = strlen(s) + 1;
|
||||
char *n = new char[l];
|
||||
strncpy(n, s, l);
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
BaseDisplay::BaseDisplay(const char *app_name, char *dpy_name) {
|
||||
BaseDisplay::BaseDisplay(const char *app_name, char *dpy_name) {
|
||||
application_name = bstrdup(app_name);
|
||||
|
||||
_startup = True;
|
||||
|
@ -383,10 +383,10 @@ static RETSIGTYPE signalhandler(int sig) {
|
|||
NumLockMask = Mod2Mask;
|
||||
ScrollLockMask = Mod5Mask;
|
||||
#endif // NOCLOBBER
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BaseDisplay::~BaseDisplay(void) {
|
||||
BaseDisplay::~BaseDisplay(void) {
|
||||
std::for_each(screenInfoList.begin(), screenInfoList.end(),
|
||||
PointerAssassin());
|
||||
// we don't create the BTimers, we don't delete them
|
||||
|
@ -395,10 +395,10 @@ static RETSIGTYPE signalhandler(int sig) {
|
|||
delete [] application_name;
|
||||
|
||||
XCloseDisplay(display);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BaseDisplay::eventLoop(void) {
|
||||
void BaseDisplay::eventLoop(void) {
|
||||
run();
|
||||
|
||||
int xfd = ConnectionNumber(display);
|
||||
|
@ -492,9 +492,10 @@ static RETSIGTYPE signalhandler(int sig) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const Bool BaseDisplay::validateWindow(Window window) {
|
||||
const Bool BaseDisplay::validateWindow(Window window) {
|
||||
XEvent event;
|
||||
if (XCheckTypedWindowEvent(display, window, DestroyNotify, &event)) {
|
||||
XPutBackEvent(display, &event);
|
||||
|
@ -503,22 +504,22 @@ static RETSIGTYPE signalhandler(int sig) {
|
|||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BaseDisplay::grab(void) {
|
||||
void BaseDisplay::grab(void) {
|
||||
if (! server_grabs++)
|
||||
XGrabServer(display);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BaseDisplay::ungrab(void) {
|
||||
void BaseDisplay::ungrab(void) {
|
||||
if (! --server_grabs)
|
||||
XUngrabServer(display);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BaseDisplay::addTimer(BTimer *timer) {
|
||||
void BaseDisplay::addTimer(BTimer *timer) {
|
||||
ASSERT(timer != (BTimer *) 0);
|
||||
|
||||
TimerList::iterator it;
|
||||
|
@ -531,32 +532,25 @@ static RETSIGTYPE signalhandler(int sig) {
|
|||
}
|
||||
|
||||
timerList.insert(it, timer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BaseDisplay::removeTimer(BTimer *timer) {
|
||||
ASSERT(timer != (BTimer *) 0);
|
||||
timerList.remove(timer);
|
||||
}
|
||||
|
||||
<<<<<<< BaseDisplay.cc
|
||||
=======
|
||||
void BaseDisplay::removeTimer(BTimer *timer) {
|
||||
ASSERT(timer != (BTimer *) 0);
|
||||
timerList.remove(timer);
|
||||
}
|
||||
>>>>>>> 1.13.4.1
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
* Grabs a button, but also grabs the button in every possible combination with
|
||||
* the keyboard lock keys, so that they do not cancel out the event.
|
||||
*/
|
||||
void BaseDisplay::grabButton(unsigned int button, unsigned int modifiers,
|
||||
void BaseDisplay::grabButton(unsigned int button, unsigned int modifiers,
|
||||
Window grab_window, Bool owner_events,
|
||||
unsigned int event_mask, int pointer_mode,
|
||||
int keybaord_mode, Window confine_to,
|
||||
Cursor cursor) const
|
||||
{
|
||||
{
|
||||
#ifndef NOCLOBBER
|
||||
for (size_t cnt = 0; cnt < MaskListLength; ++cnt)
|
||||
XGrabButton(display, button, modifiers | MaskList[cnt], grab_window,
|
||||
|
@ -567,13 +561,13 @@ void BaseDisplay::removeTimer(BTimer *timer) {
|
|||
owner_events, event_mask, pointer_mode, keybaord_mode,
|
||||
confine_to, cursor);
|
||||
#endif // NOCLOBBER
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Releases the grab on a button, and ungrabs all possible combinations of the
|
||||
* keyboard lock keys.
|
||||
*/
|
||||
void BaseDisplay::ungrabButton(unsigned int button, unsigned int modifiers,
|
||||
void BaseDisplay::ungrabButton(unsigned int button, unsigned int modifiers,
|
||||
Window grab_window) const {
|
||||
#ifndef NOCLOBBER
|
||||
for (size_t cnt = 0; cnt < MaskListLength; ++cnt)
|
||||
|
@ -581,12 +575,12 @@ void BaseDisplay::removeTimer(BTimer *timer) {
|
|||
#else // NOCLOBBER
|
||||
XUngrabButton(display, button, modifiers, grab_window);
|
||||
#endif // NOCLOBBER
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ScreenInfo::ScreenInfo(BaseDisplay &d, int num) : basedisplay(d),
|
||||
screen_number(num)
|
||||
{
|
||||
ScreenInfo::ScreenInfo(BaseDisplay &d, int num) : basedisplay(d),
|
||||
screen_number(num)
|
||||
{
|
||||
|
||||
root_window = RootWindow(basedisplay.getXDisplay(), screen_number);
|
||||
depth = DefaultDepth(basedisplay.getXDisplay(), screen_number);
|
||||
|
@ -627,4 +621,4 @@ void BaseDisplay::removeTimer(BTimer *timer) {
|
|||
visual = DefaultVisual(basedisplay.getXDisplay(), screen_number);
|
||||
colormap = DefaultColormap(basedisplay.getXDisplay(), screen_number);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ CPPFLAGS= @CPPFLAGS@ @SHAPE@ @SLIT@ @INTERLACE@ @ORDEREDPSEUDO@ \
|
|||
|
||||
bin_PROGRAMS= openbox
|
||||
|
||||
openbox_SOURCES= BaseDisplay.cc Basemenu.cc Clientmenu.cc Configmenu.cc Geometry.cc Iconmenu.cc Image.cc Netizen.cc Resource.cc Rootmenu.cc Screen.cc Slit.cc Timer.cc Toolbar.cc Window.cc Windowmenu.cc Workspace.cc Workspacemenu.cc XAtom.cc XDisplay.cc XScreen.cc openbox.cc bsd-snprintf.c i18n.cc main.cc
|
||||
openbox_SOURCES= BaseDisplay.cc Basemenu.cc Clientmenu.cc Configmenu.cc Geometry.cc Iconmenu.cc Image.cc Netizen.cc Resource.cc Rootmenu.cc Screen.cc Slit.cc Timer.cc Toolbar.cc Window.cc Windowmenu.cc Workspace.cc Workspacemenu.cc XAtom.cc openbox.cc bsd-snprintf.c i18n.cc main.cc
|
||||
|
||||
MAINTAINERCLEANFILES= Makefile.in
|
||||
|
||||
|
@ -82,9 +82,7 @@ Toolbar.o: Toolbar.cc i18n.h openbox.h BaseDisplay.h \
|
|||
Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \
|
||||
Clientmenu.h Workspace.h Rootmenu.h Screen.h Configmenu.h \
|
||||
Netizen.h Workspacemenu.h Toolbar.h Resource.h Geometry.h
|
||||
XAtom.o: XAtom.cc XAtom.h XDisplay.h XScreen.h Geometry.h Util.h
|
||||
XDisplay.o: XDisplay.cc XDisplay.h XAtom.h XScreen.h Geometry.h Util.h
|
||||
XScreen.o: XScreen.cc XScreen.h Geometry.h XDisplay.h XAtom.h
|
||||
XAtom.o: XAtom.cc XAtom.h Geometry.h Util.h
|
||||
Window.o: Window.cc i18n.h openbox.h BaseDisplay.h \
|
||||
Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \
|
||||
Screen.h Configmenu.h Netizen.h Rootmenu.h Workspace.h \
|
||||
|
|
16
src/XAtom.cc
16
src/XAtom.cc
|
@ -20,12 +20,12 @@
|
|||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#include "XAtom.h"
|
||||
#include "XDisplay.h"
|
||||
#include "XScreen.h"
|
||||
#include "openbox.h"
|
||||
#include "Screen.h"
|
||||
#include "Util.h"
|
||||
|
||||
XAtom::XAtom(const XDisplay *display) {
|
||||
_display = display->_display;
|
||||
XAtom::XAtom(Openbox &ob) {
|
||||
_display = ob.getXDisplay();
|
||||
|
||||
#ifdef HAVE_GETPID
|
||||
openbox_pid = getAtom("_BLACKBOX_PID");
|
||||
|
@ -86,8 +86,8 @@ XAtom::XAtom(const XDisplay *display) {
|
|||
|
||||
net_wm_ping = getAtom("_NET_WM_PING");
|
||||
|
||||
for (int s = 0, c = display->screenCount(); s < c; ++s)
|
||||
setSupported(display->screen(s));
|
||||
for (unsigned int s = 0, c = ob.managedScreenCount(); s < c; ++s)
|
||||
setSupported( static_cast<ScreenInfo*>(ob.getScreen(s)) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -115,9 +115,9 @@ Atom XAtom::getAtom(const char *name) const {
|
|||
/*
|
||||
* Sets which atoms are supported for NETWM, by Openbox, on the root window.
|
||||
*/
|
||||
void XAtom::setSupported(const XScreen *screen) {
|
||||
void XAtom::setSupported(const ScreenInfo *screen) {
|
||||
// create the netwm support window
|
||||
Window w = XCreateSimpleWindow(_display, screen->rootWindow(),
|
||||
Window w = XCreateSimpleWindow(_display, screen->getRootWindow(),
|
||||
0, 0, 1, 1, 0, 0, 0);
|
||||
ASSERT(w != None);
|
||||
_support_windows.push_back(w);
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
#include <X11/Xatom.h>
|
||||
#include <vector>
|
||||
|
||||
class XDisplay;
|
||||
class XScreen;
|
||||
class Openbox;
|
||||
class ScreenInfo;
|
||||
|
||||
class XAtom {
|
||||
typedef std::vector<Window> SupportWindows;
|
||||
|
@ -102,7 +102,7 @@ class XAtom {
|
|||
net_wm_ping;
|
||||
|
||||
Atom getAtom(const char *name) const;
|
||||
void setSupported(const XScreen *screen);
|
||||
void setSupported(const ScreenInfo *screen);
|
||||
|
||||
void setValue(Window win, Atom atom, Atom type, unsigned char *data,
|
||||
int size, int nelements, bool append) const;
|
||||
|
@ -114,7 +114,7 @@ class XAtom {
|
|||
XAtom& operator=(const XAtom&);
|
||||
|
||||
public:
|
||||
XAtom(const XDisplay *display);
|
||||
XAtom(Openbox &ob);
|
||||
virtual ~XAtom();
|
||||
|
||||
void setCardValue(Window win, Atom atom, long value) const; // 32-bit CARDINAL
|
||||
|
|
|
@ -223,7 +223,7 @@ Openbox::Openbox(int m_argc, char **m_argv, char *dpy_name, char *rc,
|
|||
"Openbox::Openbox: no managable screens found, aborting.\n"));
|
||||
::exit(3);
|
||||
}
|
||||
current_screen = screenList.front();
|
||||
current_screen = screenList[0];
|
||||
|
||||
// save current settings and default values
|
||||
save();
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
//forward declaration
|
||||
class BScreen;
|
||||
|
@ -115,7 +116,7 @@ private:
|
|||
typedef std::list<MenuTimestamp*> MenuTimestampList;
|
||||
MenuTimestampList menuTimestamps;
|
||||
|
||||
typedef std::list<BScreen*> ScreenList;
|
||||
typedef std::vector<BScreen*> ScreenList;
|
||||
ScreenList screenList;
|
||||
|
||||
BScreen *current_screen;
|
||||
|
@ -158,8 +159,14 @@ public:
|
|||
OpenboxWindow *focusedWindow();
|
||||
void focusWindow(OpenboxWindow *w);
|
||||
|
||||
BScreen *getScreen(int);
|
||||
inline BScreen *getScreen(unsigned int s) {
|
||||
ASSERT(s < screenList.size());
|
||||
return screenList[s];
|
||||
}
|
||||
BScreen *searchScreen(Window);
|
||||
inline unsigned int managedScreenCount() const {
|
||||
return screenList.size();
|
||||
}
|
||||
|
||||
inline Resource &getConfig() {
|
||||
return config;
|
||||
|
|
Loading…
Reference in a new issue