indentation

This commit is contained in:
fluxgen 2002-01-27 13:08:53 +00:00
parent 53ad4872bd
commit 2652479b7c
2 changed files with 518 additions and 521 deletions

View file

@ -16,81 +16,76 @@
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 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 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: BaseDisplay.cc,v 1.4 2002/01/09 14:11:20 fluxgen Exp $ // $Id: BaseDisplay.cc,v 1.5 2002/01/27 13:08:53 fluxgen Exp $
// stupid macros needed to access some functions in version 2 of the GNU C // use some GNU extensions
// library #ifndef _GNU_SOURCE
#ifndef _GNU_SOURCE #define _GNU_SOURCE
#define _GNU_SOURCE
#endif // _GNU_SOURCE #endif // _GNU_SOURCE
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "../config.h" # include "../config.h"
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
#include <X11/Xlib.h> #include "BaseDisplay.hh"
#include <X11/Xatom.h> #include "i18n.hh"
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <X11/cursorfont.h> #include <X11/cursorfont.h>
#ifdef SHAPE #ifdef SHAPE
# include <X11/extensions/shape.h> # include <X11/extensions/shape.h>
#endif // SHAPE #endif // SHAPE
#include "i18n.hh"
#include "BaseDisplay.hh"
#include "LinkedList.hh"
#include "Timer.hh"
#ifdef HAVE_FCNTL_H #ifdef HAVE_FCNTL_H
# include <fcntl.h> # include <fcntl.h>
#endif // HAVE_FCNTL_H #endif // HAVE_FCNTL_H
#ifdef HAVE_STDIO_H #ifdef HAVE_STDIO_H
# include <stdio.h> # include <stdio.h>
#endif // HAVE_STDIO_H #endif // HAVE_STDIO_H
#ifdef STDC_HEADERS #ifdef STDC_HEADERS
# include <stdlib.h> # include <stdlib.h>
# include <string.h> # include <string.h>
#endif // STDC_HEADERS #endif // STDC_HEADERS
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <sys/types.h> # include <sys/types.h>
# include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#ifdef HAVE_SYS_SELECT_H #ifdef HAVE_SYS_SELECT_H
# include <sys/select.h> # include <sys/select.h>
#endif // HAVE_SYS_SELECT_H #endif // HAVE_SYS_SELECT_H
#ifdef HAVE_SIGNAL_H #ifdef HAVE_SIGNAL_H
# include <signal.h> # include <signal.h>
#endif // HAVE_SIGNAL_H #endif // HAVE_SIGNAL_H
#ifndef SA_NODEFER #ifndef SA_NODEFER
# ifdef SA_INTERRUPT # ifdef SA_INTERRUPT
# define SA_NODEFER SA_INTERRUPT # define SA_NODEFER SA_INTERRUPT
# else // !SA_INTERRUPT # else // !SA_INTERRUPT
# define SA_NODEFER (0) # define SA_NODEFER (0)
# endif // SA_INTERRUPT # endif // SA_INTERRUPT
#endif // SA_NODEFER #endif // SA_NODEFER
#ifdef HAVE_SYS_WAIT_H #ifdef HAVE_SYS_WAIT_H
# include <sys/types.h> # include <sys/types.h>
# include <sys/wait.h> # include <sys/wait.h>
#endif // HAVE_SYS_WAIT_H #endif // HAVE_SYS_WAIT_H
#if defined(HAVE_PROCESS_H) && defined(__EMX__) #if defined(HAVE_PROCESS_H) && defined(__EMX__)
# include <process.h> # include <process.h>
#endif // HAVE_PROCESS_H __EMX__ #endif // HAVE_PROCESS_H __EMX__
// X error handler to handle any and all X errors while the application is // X error handler to handle any and all X errors while the application is
// running // running
@ -99,137 +94,138 @@ static Window last_bad_window = None;
BaseDisplay *base_display; BaseDisplay *base_display;
#ifdef DEBUG #ifdef DEBUG
static int handleXErrors(Display *d, XErrorEvent *e) { static int handleXErrors(Display *d, XErrorEvent *e) {
char errtxt[128]; char errtxt[128];
XGetErrorText(d, e->error_code, errtxt, 128);
fprintf(stderr,
I18n::instance()->
getMessage(
#ifdef NLS
BaseDisplaySet, BaseDisplayXError,
#else // !NLS
0, 0,
#endif // NLS
"%s: X error: %s(%d) opcodes %d/%d\n resource 0x%lx\n"),
base_display->getApplicationName(), errtxt, e->error_code,
e->request_code, e->minor_code, e->resourceid);
XGetErrorText(d, e->error_code, errtxt, 128);
fprintf(stderr,
I18n::instance()->
getMessage(
#ifdef NLS
BaseDisplaySet, BaseDisplayXError,
#else // !NLS
0, 0,
#endif // NLS
"%s: X error: %s(%d) opcodes %d/%d\n resource 0x%lx\n"),
base_display->getApplicationName(), errtxt, e->error_code,
e->request_code, e->minor_code, e->resourceid);
#else // !DEBUG #else // !DEBUG
static int handleXErrors(Display *, XErrorEvent *e) { static int handleXErrors(Display *, XErrorEvent *e) {
#endif // DEBUG #endif // DEBUG
if (e->error_code == BadWindow) if (e->error_code == BadWindow)
last_bad_window = e->resourceid; last_bad_window = e->resourceid;
if (internal_error) if (internal_error)
abort(); abort();
return(False); return(False);
} }
// signal handler to allow for proper and gentle shutdown // signal handler to allow for proper and gentle shutdown
#ifndef HAVE_SIGACTION #ifndef HAVE_SIGACTION
static RETSIGTYPE signalhandler(int sig) { static RETSIGTYPE signalhandler(int sig) {
#else // HAVE_SIGACTION #else // HAVE_SIGACTION
static void signalhandler(int sig) { static void signalhandler(int sig) {
#endif // HAVE_SIGACTION #endif // HAVE_SIGACTION
I18n *i18n = I18n::instance(); I18n *i18n = I18n::instance();
static int re_enter = 0; static int re_enter = 0;
switch (sig) { switch (sig) {
case SIGCHLD: case SIGCHLD:
int status; int status;
waitpid(-1, &status, WNOHANG | WUNTRACED); waitpid(-1, &status, WNOHANG | WUNTRACED);
#ifndef HAVE_SIGACTION #ifndef HAVE_SIGACTION
// assume broken, braindead sysv signal semantics // assume broken, braindead sysv signal semantics
signal(SIGCHLD, (RETSIGTYPE (*)(int)) signalhandler); signal(SIGCHLD, (RETSIGTYPE (*)(int)) signalhandler);
#endif // HAVE_SIGACTION #endif // HAVE_SIGACTION
break; break;
default: default:
if (base_display->handleSignal(sig)) { if (base_display->handleSignal(sig)) {
#ifndef HAVE_SIGACTION #ifndef HAVE_SIGACTION
// assume broken, braindead sysv signal semantics // assume broken, braindead sysv signal semantics
signal(sig, (RETSIGTYPE (*)(int)) signalhandler); signal(sig, (RETSIGTYPE (*)(int)) signalhandler);
#endif // HAVE_SIGACTION #endif // HAVE_SIGACTION
return; return;
} }
fprintf(stderr, fprintf(stderr,
i18n->getMessage( i18n->getMessage(
#ifdef NLS #ifdef NLS
BaseDisplaySet, BaseDisplaySignalCaught, BaseDisplaySet, BaseDisplaySignalCaught,
#else // !NLS #else // !NLS
0, 0, 0, 0,
#endif // NLS #endif // NLS
"%s: signal %d caught\n"), "%s: signal %d caught\n"),
base_display->getApplicationName(), sig); base_display->getApplicationName(), sig);
if (! base_display->isStartup() && ! re_enter) { if (! base_display->isStartup() && ! re_enter) {
internal_error = True; internal_error = True;
re_enter = 1; re_enter = 1;
fprintf(stderr, fprintf(stderr,
i18n->getMessage( i18n->getMessage(
#ifdef NLS #ifdef NLS
BaseDisplaySet, BaseDisplayShuttingDown, BaseDisplaySet, BaseDisplayShuttingDown,
#else // !NLS #else // !NLS
0, 0, 0, 0,
#endif // NLS #endif // NLS
"shutting down\n")); "shutting down\n"));
base_display->shutdown(); base_display->shutdown();
} }
if (sig != SIGTERM && sig != SIGINT) { if (sig != SIGTERM && sig != SIGINT) {
fprintf(stderr, fprintf(stderr,
i18n->getMessage( i18n->getMessage(
#ifdef NLS #ifdef NLS
BaseDisplaySet, BaseDisplayAborting, BaseDisplaySet, BaseDisplayAborting,
#else // !NLS #else // !NLS
0, 0, 0, 0,
#endif // NLS #endif // NLS
"aborting... dumping core\n")); "aborting... dumping core\n"));
abort(); abort();
} }
exit(0); exit(0);
break; break;
} }
} }
// convenience functions // convenience functions
#ifndef __EMX__ #ifndef __EMX__
void bexec(const char *command, char* displaystring) { void bexec(const char *command, char* displaystring) {
if (! fork()) { if (! fork()) {
setsid(); setsid();
putenv(displaystring); putenv(displaystring);
execl("/bin/sh", "/bin/sh", "-c", command, NULL); execl("/bin/sh", "/bin/sh", "-c", command, NULL);
exit(0); exit(0);
} }
} }
#endif // !__EMX__ #endif // !__EMX__
BaseDisplay::BaseDisplay(char *app_name, char *dpy_name) { BaseDisplay::BaseDisplay(char *app_name, char *dpy_name):
application_name = app_name; m_startup(true), m_shutdown(false),
m_display_name(XDisplayName(dpy_name)), m_app_name(app_name),
m_server_grabs(0)
{
_startup = True;
_shutdown = False;
server_grabs = 0;
last_bad_window = None; last_bad_window = None;
I18n *i18n = I18n::instance(); I18n *i18n = I18n::instance();
::base_display = this; ::base_display = this;
#ifdef HAVE_SIGACTION #ifdef HAVE_SIGACTION
struct sigaction action; struct sigaction action;
action.sa_handler = signalhandler; action.sa_handler = signalhandler;
@ -255,136 +251,136 @@ BaseDisplay::BaseDisplay(char *app_name, char *dpy_name) {
signal(SIGCHLD, (RETSIGTYPE (*)(int)) signalhandler); signal(SIGCHLD, (RETSIGTYPE (*)(int)) signalhandler);
#endif // HAVE_SIGACTION #endif // HAVE_SIGACTION
if (! (display = XOpenDisplay(dpy_name))) { if (! (m_display = XOpenDisplay(dpy_name))) {
fprintf(stderr, fprintf(stderr,
i18n-> i18n->
getMessage( getMessage(
#ifdef NLS #ifdef NLS
BaseDisplaySet, BaseDisplayXConnectFail, BaseDisplaySet, BaseDisplayXConnectFail,
#else // !NLS #else // !NLS
0, 0, 0, 0,
#endif // NLS #endif // NLS
"BaseDisplay::BaseDisplay: connection to X server failed.\n")); "BaseDisplay::BaseDisplay: connection to X server failed.\n"));
throw static_cast<int>(2); //throw error 2 throw static_cast<int>(2); //throw error 2
} else if (fcntl(ConnectionNumber(display), F_SETFD, 1) == -1) { } else if (fcntl(ConnectionNumber(m_display), F_SETFD, 1) == -1) {
fprintf(stderr, fprintf(stderr,
i18n-> i18n->
getMessage( getMessage(
#ifdef NLS #ifdef NLS
BaseDisplaySet, BaseDisplayCloseOnExecFail, BaseDisplaySet, BaseDisplayCloseOnExecFail,
#else // !NLS #else // !NLS
0, 0, 0, 0,
#endif // NLS #endif // NLS
"BaseDisplay::BaseDisplay: couldn't mark display connection " "BaseDisplay::BaseDisplay: couldn't mark display connection "
"as close-on-exec\n")); "as close-on-exec\n"));
throw static_cast<int>(2); //throw error 2 throw static_cast<int>(2); //throw error 2
} }
number_of_screens = ScreenCount(display); number_of_screens = ScreenCount(m_display);
display_name = XDisplayName(dpy_name);
#ifdef SHAPE #ifdef SHAPE
shape.extensions = XShapeQueryExtension(display, &shape.event_basep, shape.extensions = XShapeQueryExtension(m_display, &shape.event_basep,
&shape.error_basep); &shape.error_basep);
#else // !SHAPE #else // !SHAPE
shape.extensions = False; shape.extensions = False;
#endif // SHAPE #endif // SHAPE
//---------- setup atoms //---------- setup atoms
xa_wm_colormap_windows = xa_wm_colormap_windows =
XInternAtom(display, "WM_COLORMAP_WINDOWS", False); XInternAtom(m_display, "WM_COLORMAP_WINDOWS", False);
xa_wm_protocols = XInternAtom(display, "WM_PROTOCOLS", False); xa_wm_protocols = XInternAtom(m_display, "WM_PROTOCOLS", False);
xa_wm_state = XInternAtom(display, "WM_STATE", False); xa_wm_state = XInternAtom(m_display, "WM_STATE", False);
xa_wm_change_state = XInternAtom(display, "WM_CHANGE_STATE", False); xa_wm_change_state = XInternAtom(m_display, "WM_CHANGE_STATE", False);
xa_wm_delete_window = XInternAtom(display, "WM_DELETE_WINDOW", False); xa_wm_delete_window = XInternAtom(m_display, "WM_DELETE_WINDOW", False);
xa_wm_take_focus = XInternAtom(display, "WM_TAKE_FOCUS", False); xa_wm_take_focus = XInternAtom(m_display, "WM_TAKE_FOCUS", False);
motif_wm_hints = XInternAtom(display, "_MOTIF_WM_HINTS", False); motif_wm_hints = XInternAtom(m_display, "_MOTIF_WM_HINTS", False);
blackbox_hints = XInternAtom(display, "_BLACKBOX_HINTS", False); blackbox_hints = XInternAtom(m_display, "_BLACKBOX_HINTS", False);
blackbox_attributes = XInternAtom(display, "_BLACKBOX_ATTRIBUTES", False); blackbox_attributes = XInternAtom(m_display, "_BLACKBOX_ATTRIBUTES", False);
blackbox_change_attributes = blackbox_change_attributes =
XInternAtom(display, "_BLACKBOX_CHANGE_ATTRIBUTES", False); XInternAtom(m_display, "_BLACKBOX_CHANGE_ATTRIBUTES", False);
blackbox_structure_messages = blackbox_structure_messages =
XInternAtom(display, "_BLACKBOX_STRUCTURE_MESSAGES", False); XInternAtom(m_display, "_BLACKBOX_STRUCTURE_MESSAGES", False);
blackbox_notify_startup = blackbox_notify_startup =
XInternAtom(display, "_BLACKBOX_NOTIFY_STARTUP", False); XInternAtom(m_display, "_BLACKBOX_NOTIFY_STARTUP", False);
blackbox_notify_window_add = blackbox_notify_window_add =
XInternAtom(display, "_BLACKBOX_NOTIFY_WINDOW_ADD", False); XInternAtom(m_display, "_BLACKBOX_NOTIFY_WINDOW_ADD", False);
blackbox_notify_window_del = blackbox_notify_window_del =
XInternAtom(display, "_BLACKBOX_NOTIFY_WINDOW_DEL", False); XInternAtom(m_display, "_BLACKBOX_NOTIFY_WINDOW_DEL", False);
blackbox_notify_current_workspace = blackbox_notify_current_workspace =
XInternAtom(display, "_BLACKBOX_NOTIFY_CURRENT_WORKSPACE", False); XInternAtom(m_display, "_BLACKBOX_NOTIFY_CURRENT_WORKSPACE", False);
blackbox_notify_workspace_count = blackbox_notify_workspace_count =
XInternAtom(display, "_BLACKBOX_NOTIFY_WORKSPACE_COUNT", False); XInternAtom(m_display, "_BLACKBOX_NOTIFY_WORKSPACE_COUNT", False);
blackbox_notify_window_focus = blackbox_notify_window_focus =
XInternAtom(display, "_BLACKBOX_NOTIFY_WINDOW_FOCUS", False); XInternAtom(m_display, "_BLACKBOX_NOTIFY_WINDOW_FOCUS", False);
blackbox_notify_window_raise = blackbox_notify_window_raise =
XInternAtom(display, "_BLACKBOX_NOTIFY_WINDOW_RAISE", False); XInternAtom(m_display, "_BLACKBOX_NOTIFY_WINDOW_RAISE", False);
blackbox_notify_window_lower = blackbox_notify_window_lower =
XInternAtom(display, "_BLACKBOX_NOTIFY_WINDOW_LOWER", False); XInternAtom(m_display, "_BLACKBOX_NOTIFY_WINDOW_LOWER", False);
blackbox_change_workspace = blackbox_change_workspace =
XInternAtom(display, "_BLACKBOX_CHANGE_WORKSPACE", False); XInternAtom(m_display, "_BLACKBOX_CHANGE_WORKSPACE", False);
blackbox_change_window_focus = blackbox_change_window_focus =
XInternAtom(display, "_BLACKBOX_CHANGE_WINDOW_FOCUS", False); XInternAtom(m_display, "_BLACKBOX_CHANGE_WINDOW_FOCUS", False);
blackbox_cycle_window_focus = blackbox_cycle_window_focus =
XInternAtom(display, "_BLACKBOX_CYCLE_WINDOW_FOCUS", False); XInternAtom(m_display, "_BLACKBOX_CYCLE_WINDOW_FOCUS", False);
#ifdef NEWWMSPEC #ifdef NEWWMSPEC
net_supported = XInternAtom(display, "_NET_SUPPORTED", False); net_supported = XInternAtom(m_display, "_NET_SUPPORTED", False);
net_client_list = XInternAtom(display, "_NET_CLIENT_LIST", False); net_client_list = XInternAtom(m_display, "_NET_CLIENT_LIST", False);
net_client_list_stacking = XInternAtom(display, "_NET_CLIENT_LIST_STACKING", False); net_client_list_stacking = XInternAtom(m_display, "_NET_CLIENT_LIST_STACKING", False);
net_number_of_desktops = XInternAtom(display, "_NET_NUMBER_OF_DESKTOPS", False); net_number_of_desktops = XInternAtom(m_display, "_NET_NUMBER_OF_DESKTOPS", False);
net_desktop_geometry = XInternAtom(display, "_NET_DESKTOP_GEOMETRY", False); net_desktop_geometry = XInternAtom(m_display, "_NET_DESKTOP_GEOMETRY", False);
net_desktop_viewport = XInternAtom(display, "_NET_DESKTOP_VIEWPORT", False); net_desktop_viewport = XInternAtom(m_display, "_NET_DESKTOP_VIEWPORT", False);
net_current_desktop = XInternAtom(display, "_NET_CURRENT_DESKTOP", False); net_current_desktop = XInternAtom(m_display, "_NET_CURRENT_DESKTOP", False);
net_desktop_names = XInternAtom(display, "_NET_DESKTOP_NAMES", False); net_desktop_names = XInternAtom(m_display, "_NET_DESKTOP_NAMES", False);
net_active_window = XInternAtom(display, "_NET_ACTIVE_WINDOW", False); net_active_window = XInternAtom(m_display, "_NET_ACTIVE_WINDOW", False);
net_workarea = XInternAtom(display, "_NET_WORKAREA", False); net_workarea = XInternAtom(m_display, "_NET_WORKAREA", False);
net_supporting_wm_check = XInternAtom(display, "_NET_SUPPORTING_WM_CHECK", False); net_supporting_wm_check = XInternAtom(m_display, "_NET_SUPPORTING_WM_CHECK", False);
net_virtual_roots = XInternAtom(display, "_NET_VIRTUAL_ROOTS", False); net_virtual_roots = XInternAtom(m_display, "_NET_VIRTUAL_ROOTS", False);
net_close_window = XInternAtom(display, "_NET_CLOSE_WINDOW", False); net_close_window = XInternAtom(m_display, "_NET_CLOSE_WINDOW", False);
net_wm_moveresize = XInternAtom(display, "_NET_WM_MOVERESIZE", False); net_wm_moveresize = XInternAtom(m_display, "_NET_WM_MOVERESIZE", False);
net_properties = XInternAtom(display, "_NET_PROPERTIES", False); net_properties = XInternAtom(m_display, "_NET_PROPERTIES", False);
net_wm_name = XInternAtom(display, "_NET_WM_NAME", False); net_wm_name = XInternAtom(m_display, "_NET_WM_NAME", False);
net_wm_desktop = XInternAtom(display, "_NET_WM_DESKTOP", False); net_wm_desktop = XInternAtom(m_display, "_NET_WM_DESKTOP", False);
net_wm_window_type = XInternAtom(display, "_NET_WM_WINDOW_TYPE", False); net_wm_window_type = XInternAtom(m_display, "_NET_WM_WINDOW_TYPE", False);
net_wm_state = XInternAtom(display, "_NET_WM_STATE", False); net_wm_state = XInternAtom(m_display, "_NET_WM_STATE", False);
net_wm_strut = XInternAtom(display, "_NET_WM_STRUT", False); net_wm_strut = XInternAtom(m_display, "_NET_WM_STRUT", False);
net_wm_icon_geometry = XInternAtom(display, "_NET_WM_ICON_GEOMETRY", False); net_wm_icon_geometry = XInternAtom(m_display, "_NET_WM_ICON_GEOMETRY", False);
net_wm_icon = XInternAtom(display, "_NET_WM_ICON", False); net_wm_icon = XInternAtom(m_display, "_NET_WM_ICON", False);
net_wm_pid = XInternAtom(display, "_NET_WM_PID", False); net_wm_pid = XInternAtom(m_display, "_NET_WM_PID", False);
net_wm_handled_icons = XInternAtom(display, "_NET_WM_HANDLED_ICONS", False); net_wm_handled_icons = XInternAtom(m_display, "_NET_WM_HANDLED_ICONS", False);
net_wm_ping = XInternAtom(display, "_NET_WM_PING", False); net_wm_ping = XInternAtom(m_display, "_NET_WM_PING", False);
#endif // NEWWMSPEC #endif // NEWWMSPEC
#ifdef GNOME #ifdef GNOME
gnome_wm_win_layer = XInternAtom(display, "_WIN_LAYER", False); gnome_wm_win_layer = XInternAtom(m_display, "_WIN_LAYER", False);
gnome_wm_win_state = XInternAtom(display, "_WIN_STATE", False); gnome_wm_win_state = XInternAtom(m_display, "_WIN_STATE", False);
gnome_wm_win_hints = XInternAtom(display, "_WIN_HINTS", False); gnome_wm_win_hints = XInternAtom(m_display, "_WIN_HINTS", False);
gnome_wm_win_app_state = XInternAtom(display, "_WIN_APP_STATE", False); gnome_wm_win_app_state = XInternAtom(m_display, "_WIN_APP_STATE", False);
gnome_wm_win_expanded_size = XInternAtom(display, "_WIN_EXPANDED_SIZE", False); gnome_wm_win_expanded_size = XInternAtom(m_display, "_WIN_EXPANDED_SIZE", False);
gnome_wm_win_icons = XInternAtom(display, "_WIN_ICONS", False); gnome_wm_win_icons = XInternAtom(m_display, "_WIN_ICONS", False);
gnome_wm_win_workspace = XInternAtom(display, "_WIN_WORKSPACE", False); gnome_wm_win_workspace = XInternAtom(m_display, "_WIN_WORKSPACE", False);
gnome_wm_win_workspace_count = XInternAtom(display, "_WIN_WORKSPACE_COUNT", False); gnome_wm_win_workspace_count = XInternAtom(m_display, "_WIN_WORKSPACE_COUNT", False);
gnome_wm_win_workspace_names = XInternAtom(display, "_WIN_WORKSPACE_NAMES", False); gnome_wm_win_workspace_names = XInternAtom(m_display, "_WIN_WORKSPACE_NAMES", False);
gnome_wm_win_client_list = XInternAtom(display, "_WIN_CLIENT_LIST", False); gnome_wm_win_client_list = XInternAtom(m_display, "_WIN_CLIENT_LIST", False);
gnome_wm_prot = XInternAtom(display, "_WIN_PROTOCOLS", False); gnome_wm_prot = XInternAtom(m_display, "_WIN_PROTOCOLS", False);
gnome_wm_supporting_wm_check = XInternAtom(display, "_WIN_SUPPORTING_WM_CHECK", False); gnome_wm_supporting_wm_check = XInternAtom(m_display, "_WIN_SUPPORTING_WM_CHECK", False);
#endif // GNOME #endif // GNOME
cursor.session = XCreateFontCursor(display, XC_left_ptr); cursor.session = XCreateFontCursor(m_display, XC_left_ptr);
cursor.move = XCreateFontCursor(display, XC_fleur); cursor.move = XCreateFontCursor(m_display, XC_fleur);
cursor.ll_angle = XCreateFontCursor(display, XC_ll_angle); cursor.ll_angle = XCreateFontCursor(m_display, XC_ll_angle);
cursor.lr_angle = XCreateFontCursor(display, XC_lr_angle); cursor.lr_angle = XCreateFontCursor(m_display, XC_lr_angle);
XSetErrorHandler((XErrorHandler) handleXErrors); XSetErrorHandler((XErrorHandler) handleXErrors);
@ -402,47 +398,47 @@ BaseDisplay::BaseDisplay(char *app_name, char *dpy_name) {
BaseDisplay::~BaseDisplay(void) { BaseDisplay::~BaseDisplay(void) {
while (screenInfoList->count()) { while (screenInfoList->count()) {
ScreenInfo *si = screenInfoList->first(); ScreenInfo *si = screenInfoList->first();
screenInfoList->remove(si); screenInfoList->remove(si);
delete si; delete si;
} }
delete screenInfoList; delete screenInfoList;
// we don't create the BTimers, we don't delete them // we don't create the BTimers, we don't delete them
while (timerList->count()) while (timerList->count())
timerList->remove(0); timerList->remove(0);
delete timerList; delete timerList;
XCloseDisplay(display); XCloseDisplay(m_display);
} }
void BaseDisplay::eventLoop(void) { void BaseDisplay::eventLoop(void) {
run(); run();
int xfd = ConnectionNumber(display); int xfd = ConnectionNumber(m_display);
while ((! _shutdown) && (! internal_error)) { while ((! m_shutdown) && (! internal_error)) {
if (XPending(display)) { if (XPending(m_display)) {
XEvent e; XEvent e;
XNextEvent(display, &e); XNextEvent(m_display, &e);
if (last_bad_window != None && e.xany.window == last_bad_window) { if (last_bad_window != None && e.xany.window == last_bad_window) {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, fprintf(stderr,
I18n::instance()-> I18n::instance()->
getMessage( getMessage(
#ifdef NLS #ifdef NLS
BaseDisplaySet, BaseDisplayBadWindowRemove, BaseDisplaySet, BaseDisplayBadWindowRemove,
#else // !NLS #else // !NLS
0, 0, 0, 0,
#endif // NLS #endif // NLS
"BaseDisplay::eventLoop(): removing bad window " "BaseDisplay::eventLoop(): removing bad window "
"from event queue\n")); "from event queue\n"));
#endif // DEBUG #endif // DEBUG
} else { } else {
last_bad_window = None; last_bad_window = None;
process_event(&e); process_event(&e);
@ -513,93 +509,94 @@ void BaseDisplay::eventLoop(void) {
} }
const Bool BaseDisplay::validateWindow(Window window) { const bool BaseDisplay::validateWindow(Window window) {
XEvent event; XEvent event;
if (XCheckTypedWindowEvent(display, window, DestroyNotify, &event)) { if (XCheckTypedWindowEvent(m_display, window, DestroyNotify, &event)) {
XPutBackEvent(display, &event); XPutBackEvent(m_display, &event);
return false;
}
return False; return true;
}
return True;
} }
void BaseDisplay::grab(void) { void BaseDisplay::grab(void) {
if (! server_grabs++) if (! m_server_grabs++)
XGrabServer(display); XGrabServer(m_display);
} }
void BaseDisplay::ungrab(void) { void BaseDisplay::ungrab(void) {
if (! --server_grabs) if (! --m_server_grabs)
XUngrabServer(display); XUngrabServer(m_display);
if (m_server_grabs < 0)
if (server_grabs < 0) server_grabs = 0; m_server_grabs = 0;
} }
void BaseDisplay::addTimer(BTimer *timer) { void BaseDisplay::addTimer(BTimer *timer) {
if (! timer) return; if (! timer) return;
LinkedListIterator<BTimer> it(timerList); LinkedListIterator<BTimer> it(timerList);
int index = 0; int index = 0;
for (; it.current(); it++, index++) for (; it.current(); it++, index++) {
if ((it.current()->getTimeout().tv_sec > timer->getTimeout().tv_sec) || if ((it.current()->getTimeout().tv_sec > timer->getTimeout().tv_sec) ||
((it.current()->getTimeout().tv_sec == timer->getTimeout().tv_sec) && ((it.current()->getTimeout().tv_sec == timer->getTimeout().tv_sec) &&
(it.current()->getTimeout().tv_usec >= timer->getTimeout().tv_usec))) (it.current()->getTimeout().tv_usec >= timer->getTimeout().tv_usec)))
break; break;
}
timerList->insert(timer, index); timerList->insert(timer, index);
} }
void BaseDisplay::removeTimer(BTimer *timer) { void BaseDisplay::removeTimer(BTimer *timer) {
timerList->remove(timer); timerList->remove(timer);
} }
ScreenInfo::ScreenInfo(BaseDisplay *d, int num) { ScreenInfo::ScreenInfo(BaseDisplay *d, int num) {
basedisplay = d; basedisplay = d;
screen_number = num; screen_number = num;
root_window = RootWindow(basedisplay->getXDisplay(), screen_number); root_window = RootWindow(basedisplay->getXDisplay(), screen_number);
depth = DefaultDepth(basedisplay->getXDisplay(), screen_number); depth = DefaultDepth(basedisplay->getXDisplay(), screen_number);
width = width =
WidthOfScreen(ScreenOfDisplay(basedisplay->getXDisplay(), screen_number)); WidthOfScreen(ScreenOfDisplay(basedisplay->getXDisplay(), screen_number));
height = height =
HeightOfScreen(ScreenOfDisplay(basedisplay->getXDisplay(), screen_number)); HeightOfScreen(ScreenOfDisplay(basedisplay->getXDisplay(), screen_number));
// search for a TrueColor Visual... if we can't find one... we will use the // search for a TrueColor Visual... if we can't find one... we will use the
// default visual for the screen // default visual for the screen
XVisualInfo vinfo_template, *vinfo_return; XVisualInfo vinfo_template, *vinfo_return;
int vinfo_nitems; int vinfo_nitems;
vinfo_template.screen = screen_number; vinfo_template.screen = screen_number;
vinfo_template.c_class = TrueColor; vinfo_template.c_class = TrueColor;
visual = (Visual *) 0; visual = (Visual *) 0;
if ((vinfo_return = XGetVisualInfo(basedisplay->getXDisplay(), if ((vinfo_return = XGetVisualInfo(basedisplay->getXDisplay(),
VisualScreenMask | VisualClassMask, VisualScreenMask | VisualClassMask,
&vinfo_template, &vinfo_nitems)) && &vinfo_template, &vinfo_nitems)) &&
vinfo_nitems > 0) { vinfo_nitems > 0) {
for (int i = 0; i < vinfo_nitems; i++) {
if (depth < (vinfo_return + i)->depth) {
depth = (vinfo_return + i)->depth;
visual = (vinfo_return + i)->visual;
}
}
XFree(vinfo_return); for (int i = 0; i < vinfo_nitems; i++) {
} if (depth < (vinfo_return + i)->depth) {
depth = (vinfo_return + i)->depth;
visual = (vinfo_return + i)->visual;
}
}
if (visual) XFree(vinfo_return);
colormap = XCreateColormap(basedisplay->getXDisplay(), root_window, }
visual, AllocNone);
else { if (visual)
visual = DefaultVisual(basedisplay->getXDisplay(), screen_number); colormap = XCreateColormap(basedisplay->getXDisplay(), root_window,
colormap = DefaultColormap(basedisplay->getXDisplay(), screen_number); visual, AllocNone);
} else {
visual = DefaultVisual(basedisplay->getXDisplay(), screen_number);
colormap = DefaultColormap(basedisplay->getXDisplay(), screen_number);
}
} }

View file

@ -16,16 +16,20 @@
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 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 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: BaseDisplay.hh,v 1.7 2002/01/20 02:09:40 fluxgen Exp $ // $Id: BaseDisplay.hh,v 1.8 2002/01/27 13:08:53 fluxgen Exp $
#ifndef _BASEDISPLAY_HH_ #ifndef _BASEDISPLAY_HH_
#define _BASEDISPLAY_HH_ #define _BASEDISPLAY_HH_
#include "LinkedList.hh"
#include "Timer.hh"
#include "NotCopyable.hh"
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xatom.h> #include <X11/Xatom.h>
@ -33,15 +37,10 @@
// forward declaration // forward declaration
class ScreenInfo; class ScreenInfo;
#include "LinkedList.hh" #define PropBlackboxHintsElements (5)
#include "Timer.hh" #define PropBlackboxAttributesElements (8)
#include "NotCopyable.hh"
#ifndef __EMX__
#define PropBlackboxHintsElements (5)
#define PropBlackboxAttributesElements (8)
#ifndef __EMX__
void bexec(const char *, char *); void bexec(const char *, char *);
#endif // !__EMX__ #endif // !__EMX__
@ -49,11 +48,12 @@ void bexec(const char *, char *);
template <typename Z> inline Z min(Z a, Z b) { return ((a < b) ? a : b); } template <typename Z> inline Z min(Z a, Z b) { return ((a < b) ? a : b); }
template <typename Z> inline Z max(Z a, Z b) { return ((a > b) ? a : b); } template <typename Z> inline Z max(Z a, Z b) { return ((a > b) ? a : b); }
class BaseDisplay { class BaseDisplay:private NotCopyable
{
public: public:
BaseDisplay(char *, char * = 0); BaseDisplay(char *, char * = 0);
virtual ~BaseDisplay(void); virtual ~BaseDisplay(void);
enum Attrib { enum Attrib {
ATTRIB_SHADED = 0x01, ATTRIB_SHADED = 0x01,
@ -63,19 +63,19 @@ public:
ATTRIB_WORKSPACE = 0x10, ATTRIB_WORKSPACE = 0x10,
ATTRIB_STACK = 0x20, ATTRIB_STACK = 0x20,
ATTRIB_DECORATION = 0x40 ATTRIB_DECORATION = 0x40
}; };
enum Decor {DECOR_NONE=0, DECOR_NORMAL, DECOR_TINY, DECOR_TOOL}; enum Decor {DECOR_NONE=0, DECOR_NORMAL, DECOR_TINY, DECOR_TOOL};
enum Stack {STACK_TOP=0, STACK_NORMAL, STACK_BOTTOM}; enum Stack {STACK_TOP=0, STACK_NORMAL, STACK_BOTTOM};
typedef struct _blackbox_hints { typedef struct _blackbox_hints {
unsigned long flags, attrib, workspace, stack; unsigned long flags, attrib, workspace, stack;
Decor decoration; Decor decoration;
} BlackboxHints; } BlackboxHints;
typedef struct _blackbox_attributes { typedef struct _blackbox_attributes {
unsigned long flags, attrib, workspace, stack; unsigned long flags, attrib, workspace, stack;
int premax_x, premax_y; int premax_x, premax_y;
unsigned int premax_w, premax_h; unsigned int premax_w, premax_h;
} BlackboxAttributes; } BlackboxAttributes;
#ifdef GNOME #ifdef GNOME
@ -88,175 +88,175 @@ public:
inline Atom &getGnomeWorkspaceNamesAtom() { return gnome_wm_win_workspace_names; } inline Atom &getGnomeWorkspaceNamesAtom() { return gnome_wm_win_workspace_names; }
#endif //GNOME #endif //GNOME
inline const Atom &getWMChangeStateAtom(void) const inline const Atom &getWMChangeStateAtom(void) const
{ return xa_wm_change_state; } { return xa_wm_change_state; }
inline const Atom &getWMStateAtom(void) const inline const Atom &getWMStateAtom(void) const
{ return xa_wm_state; } { return xa_wm_state; }
inline const Atom &getWMDeleteAtom(void) const inline const Atom &getWMDeleteAtom(void) const
{ return xa_wm_delete_window; } { return xa_wm_delete_window; }
inline const Atom &getWMProtocolsAtom(void) const inline const Atom &getWMProtocolsAtom(void) const
{ return xa_wm_protocols; } { return xa_wm_protocols; }
inline const Atom &getWMTakeFocusAtom(void) const inline const Atom &getWMTakeFocusAtom(void) const
{ return xa_wm_take_focus; } { return xa_wm_take_focus; }
inline const Atom &getWMColormapAtom(void) const inline const Atom &getWMColormapAtom(void) const
{ return xa_wm_colormap_windows; } { return xa_wm_colormap_windows; }
inline const Atom &getMotifWMHintsAtom(void) const inline const Atom &getMotifWMHintsAtom(void) const
{ return motif_wm_hints; } { return motif_wm_hints; }
// this atom is for normal app->WM hints about decorations, stacking, // this atom is for normal app->WM hints about decorations, stacking,
// starting workspace etc... // starting workspace etc...
inline const Atom &getFluxboxHintsAtom(void) const inline const Atom &getFluxboxHintsAtom(void) const
{ return blackbox_hints;} { return blackbox_hints;}
// these atoms are for normal app->WM interaction beyond the scope of the // these atoms are for normal app->WM interaction beyond the scope of the
// ICCCM... // ICCCM...
inline const Atom &getFluxboxAttributesAtom(void) const inline const Atom &getFluxboxAttributesAtom(void) const
{ return blackbox_attributes; } { return blackbox_attributes; }
inline const Atom &getFluxboxChangeAttributesAtom(void) const inline const Atom &getFluxboxChangeAttributesAtom(void) const
{ return blackbox_change_attributes; } { return blackbox_change_attributes; }
// these atoms are for window->WM interaction, with more control and // these atoms are for window->WM interaction, with more control and
// information on window "structure"... common examples are // information on window "structure"... common examples are
// notifying apps when windows are raised/lowered... when the user changes // notifying apps when windows are raised/lowered... when the user changes
// workspaces... i.e. "pager talk" // workspaces... i.e. "pager talk"
inline const Atom &getFluxboxStructureMessagesAtom(void) const inline const Atom &getFluxboxStructureMessagesAtom(void) const
{ return blackbox_structure_messages; } { return blackbox_structure_messages; }
// *Notify* portions of the NETStructureMessages protocol // *Notify* portions of the NETStructureMessages protocol
inline const Atom &getFluxboxNotifyStartupAtom(void) const inline const Atom &getFluxboxNotifyStartupAtom(void) const
{ return blackbox_notify_startup; } { return blackbox_notify_startup; }
inline const Atom &getFluxboxNotifyWindowAddAtom(void) const inline const Atom &getFluxboxNotifyWindowAddAtom(void) const
{ return blackbox_notify_window_add; } { return blackbox_notify_window_add; }
inline const Atom &getFluxboxNotifyWindowDelAtom(void) const inline const Atom &getFluxboxNotifyWindowDelAtom(void) const
{ return blackbox_notify_window_del; } { return blackbox_notify_window_del; }
inline const Atom &getFluxboxNotifyWindowFocusAtom(void) const inline const Atom &getFluxboxNotifyWindowFocusAtom(void) const
{ return blackbox_notify_window_focus; } { return blackbox_notify_window_focus; }
inline const Atom &getFluxboxNotifyCurrentWorkspaceAtom(void) const inline const Atom &getFluxboxNotifyCurrentWorkspaceAtom(void) const
{ return blackbox_notify_current_workspace; } { return blackbox_notify_current_workspace; }
inline const Atom &getFluxboxNotifyWorkspaceCountAtom(void) const inline const Atom &getFluxboxNotifyWorkspaceCountAtom(void) const
{ return blackbox_notify_workspace_count; } { return blackbox_notify_workspace_count; }
inline const Atom &getFluxboxNotifyWindowRaiseAtom(void) const inline const Atom &getFluxboxNotifyWindowRaiseAtom(void) const
{ return blackbox_notify_window_raise; } { return blackbox_notify_window_raise; }
inline const Atom &getFluxboxNotifyWindowLowerAtom(void) const inline const Atom &getFluxboxNotifyWindowLowerAtom(void) const
{ return blackbox_notify_window_lower; } { return blackbox_notify_window_lower; }
// atoms to change that request changes to the desktop environment during // atoms to change that request changes to the desktop environment during
// runtime... these messages can be sent by any client... as the sending // runtime... these messages can be sent by any client... as the sending
// client window id is not included in the ClientMessage event... // client window id is not included in the ClientMessage event...
inline const Atom &getFluxboxChangeWorkspaceAtom(void) const inline const Atom &getFluxboxChangeWorkspaceAtom(void) const
{ return blackbox_change_workspace; } { return blackbox_change_workspace; }
inline const Atom &getFluxboxChangeWindowFocusAtom(void) const inline const Atom &getFluxboxChangeWindowFocusAtom(void) const
{ return blackbox_change_window_focus; } { return blackbox_change_window_focus; }
inline const Atom &getFluxboxCycleWindowFocusAtom(void) const inline const Atom &getFluxboxCycleWindowFocusAtom(void) const
{ return blackbox_cycle_window_focus; } { return blackbox_cycle_window_focus; }
#ifdef NEWWMSPEC #ifdef NEWWMSPEC
// root window properties // root window properties
inline const Atom &getNETSupportedAtom(void) const inline const Atom &getNETSupportedAtom(void) const
{ return net_supported; } { return net_supported; }
inline const Atom &getNETClientListAtom(void) const inline const Atom &getNETClientListAtom(void) const
{ return net_client_list; } { return net_client_list; }
inline const Atom &getNETClientListStackingAtom(void) const inline const Atom &getNETClientListStackingAtom(void) const
{ return net_client_list_stacking; } { return net_client_list_stacking; }
inline const Atom &getNETNumberOfDesktopsAtom(void) const inline const Atom &getNETNumberOfDesktopsAtom(void) const
{ return net_number_of_desktops; } { return net_number_of_desktops; }
inline const Atom &getNETDesktopGeometryAtom(void) const inline const Atom &getNETDesktopGeometryAtom(void) const
{ return net_desktop_geometry; } { return net_desktop_geometry; }
inline const Atom &getNETDesktopViewportAtom(void) const inline const Atom &getNETDesktopViewportAtom(void) const
{ return net_desktop_viewport; } { return net_desktop_viewport; }
inline const Atom &getNETCurrentDesktopAtom(void) const inline const Atom &getNETCurrentDesktopAtom(void) const
{ return net_current_desktop; } { return net_current_desktop; }
inline const Atom &getNETDesktopNamesAtom(void) const inline const Atom &getNETDesktopNamesAtom(void) const
{ return net_desktop_names; } { return net_desktop_names; }
inline const Atom &getNETActiveWindowAtom(void) const inline const Atom &getNETActiveWindowAtom(void) const
{ return net_active_window; } { return net_active_window; }
inline const Atom &getNETWorkareaAtom(void) const inline const Atom &getNETWorkareaAtom(void) const
{ return net_workarea; } { return net_workarea; }
inline const Atom &getNETSupportingWMCheckAtom(void) const inline const Atom &getNETSupportingWMCheckAtom(void) const
{ return net_supporting_wm_check; } { return net_supporting_wm_check; }
inline const Atom &getNETVirtualRootsAtom(void) const inline const Atom &getNETVirtualRootsAtom(void) const
{ return net_virtual_roots; } { return net_virtual_roots; }
// root window messages // root window messages
inline const Atom &getNETCloseWindowAtom(void) const inline const Atom &getNETCloseWindowAtom(void) const
{ return net_close_window; } { return net_close_window; }
inline const Atom &getNETWMMoveResizeAtom(void) const inline const Atom &getNETWMMoveResizeAtom(void) const
{ return net_wm_moveresize; } { return net_wm_moveresize; }
// application window properties // application window properties
inline const Atom &getNETPropertiesAtom(void) const inline const Atom &getNETPropertiesAtom(void) const
{ return net_properties; } { return net_properties; }
inline const Atom &getNETWMNameAtom(void) const inline const Atom &getNETWMNameAtom(void) const
{ return net_wm_name; } { return net_wm_name; }
inline const Atom &getNETWMDesktopAtom(void) const inline const Atom &getNETWMDesktopAtom(void) const
{ return net_wm_desktop; } { return net_wm_desktop; }
inline const Atom &getNETWMWindowTypeAtom(void) const inline const Atom &getNETWMWindowTypeAtom(void) const
{ return net_wm_window_type; } { return net_wm_window_type; }
inline const Atom &getNETWMStateAtom(void) const inline const Atom &getNETWMStateAtom(void) const
{ return net_wm_state; } { return net_wm_state; }
inline const Atom &getNETWMStrutAtom(void) const inline const Atom &getNETWMStrutAtom(void) const
{ return net_wm_strut; } { return net_wm_strut; }
inline const Atom &getNETWMIconGeometryAtom(void) const inline const Atom &getNETWMIconGeometryAtom(void) const
{ return net_wm_icon_geometry; } { return net_wm_icon_geometry; }
inline const Atom &getNETWMIconAtom(void) const inline const Atom &getNETWMIconAtom(void) const
{ return net_wm_icon; } { return net_wm_icon; }
inline const Atom &getNETWMPidAtom(void) const inline const Atom &getNETWMPidAtom(void) const
{ return net_wm_pid; } { return net_wm_pid; }
inline const Atom &getNETWMHandledIconsAtom(void) const inline const Atom &getNETWMHandledIconsAtom(void) const
{ return net_wm_handled_icons; } { return net_wm_handled_icons; }
// application protocols // application protocols
inline const Atom &getNETWMPingAtom(void) const inline const Atom &getNETWMPingAtom(void) const
{ return net_wm_ping; } { return net_wm_ping; }
#endif // NEWWMSPEC #endif // NEWWMSPEC
inline ScreenInfo *getScreenInfo(int s) inline ScreenInfo *getScreenInfo(int s)
{ return (ScreenInfo *) screenInfoList->find(s); } { return (ScreenInfo *) screenInfoList->find(s); }
inline const Bool &hasShapeExtensions(void) const inline const Bool &hasShapeExtensions(void) const
{ return shape.extensions; } { return shape.extensions; }
inline const Bool &doShutdown(void) const inline const bool &doShutdown(void) const
{ return _shutdown; } { return m_shutdown; }
inline const Bool &isStartup(void) const inline const bool &isStartup(void) const
{ return _startup; } { return m_startup; }
inline const Cursor &getSessionCursor(void) const inline const Cursor &getSessionCursor(void) const
{ return cursor.session; } { return cursor.session; }
inline const Cursor &getMoveCursor(void) const inline const Cursor &getMoveCursor(void) const
{ return cursor.move; } { return cursor.move; }
inline const Cursor &getLowerLeftAngleCursor(void) const inline const Cursor &getLowerLeftAngleCursor(void) const
{ return cursor.ll_angle; } { return cursor.ll_angle; }
inline const Cursor &getLowerRightAngleCursor(void) const inline const Cursor &getLowerRightAngleCursor(void) const
{ return cursor.lr_angle; } { return cursor.lr_angle; }
inline Display *getXDisplay(void) { return display; } inline Display *getXDisplay(void) { return m_display; }
inline const char *getXDisplayName(void) const inline const char *getXDisplayName(void) const
{ return (const char *) display_name; } { return const_cast<const char *>(m_display_name); }
inline const char *getApplicationName(void) const inline const char *getApplicationName(void) const
{ return (const char *) application_name; } { return const_cast<const char *>(m_app_name); }
inline const int &getNumberOfScreens(void) const inline const int &getNumberOfScreens(void) const
{ return number_of_screens; } { return number_of_screens; }
inline const int &getShapeEventBase(void) const inline const int &getShapeEventBase(void) const
{ return shape.event_basep; } { return shape.event_basep; }
inline void shutdown(void) { _shutdown = True; } inline void shutdown(void) { m_shutdown = true; }
inline void run(void) { _startup = _shutdown = False; } inline void run(void) { m_startup = m_shutdown = false; }
const Bool validateWindow(Window); const bool validateWindow(Window);
void grab(void); void grab(void);
void ungrab(void); void ungrab(void);
void eventLoop(void); void eventLoop(void);
void addTimer(BTimer *); void addTimer(BTimer *);
void removeTimer(BTimer *); void removeTimer(BTimer *);
// another pure virtual... this is used to handle signals that BaseDisplay // another pure virtual... this is used to handle signals that BaseDisplay
// doesn't understand itself // doesn't understand itself
virtual Bool handleSignal(int) = 0; virtual Bool handleSignal(int) = 0;
class GrabGuard:private NotCopyable class GrabGuard:private NotCopyable
{ {
@ -270,52 +270,52 @@ public:
}; };
private: private:
struct cursor { struct cursor {
Cursor session, move, ll_angle, lr_angle; Cursor session, move, ll_angle, lr_angle;
} cursor; } cursor;
struct shape { struct shape {
Bool extensions; Bool extensions;
int event_basep, error_basep; int event_basep, error_basep;
} shape; } shape;
Atom xa_wm_colormap_windows, xa_wm_protocols, xa_wm_state, Atom xa_wm_colormap_windows, xa_wm_protocols, xa_wm_state,
xa_wm_delete_window, xa_wm_take_focus, xa_wm_change_state, xa_wm_delete_window, xa_wm_take_focus, xa_wm_change_state,
motif_wm_hints; motif_wm_hints;
// NETAttributes // NETAttributes
Atom blackbox_attributes, blackbox_change_attributes, blackbox_hints; Atom blackbox_attributes, blackbox_change_attributes, blackbox_hints;
// NETStructureMessages // NETStructureMessages
Atom blackbox_structure_messages, blackbox_notify_startup, Atom blackbox_structure_messages, blackbox_notify_startup,
blackbox_notify_window_add, blackbox_notify_window_del, blackbox_notify_window_add, blackbox_notify_window_del,
blackbox_notify_window_focus, blackbox_notify_current_workspace, blackbox_notify_window_focus, blackbox_notify_current_workspace,
blackbox_notify_workspace_count, blackbox_notify_window_raise, blackbox_notify_workspace_count, blackbox_notify_window_raise,
blackbox_notify_window_lower; blackbox_notify_window_lower;
// message_types for client -> wm messages // message_types for client -> wm messages
Atom blackbox_change_workspace, blackbox_change_window_focus, Atom blackbox_change_workspace, blackbox_change_window_focus,
blackbox_cycle_window_focus; blackbox_cycle_window_focus;
#ifdef NEWWMSPEC #ifdef NEWWMSPEC
// root window properties // root window properties
Atom net_supported, net_client_list, net_client_list_stacking, Atom net_supported, net_client_list, net_client_list_stacking,
net_number_of_desktops, net_desktop_geometry, net_desktop_viewport, net_number_of_desktops, net_desktop_geometry, net_desktop_viewport,
net_current_desktop, net_desktop_names, net_active_window, net_workarea, net_current_desktop, net_desktop_names, net_active_window, net_workarea,
net_supporting_wm_check, net_virtual_roots; net_supporting_wm_check, net_virtual_roots;
// root window messages // root window messages
Atom net_close_window, net_wm_moveresize; Atom net_close_window, net_wm_moveresize;
// application window properties // application window properties
Atom net_properties, net_wm_name, net_wm_desktop, net_wm_window_type, Atom net_properties, net_wm_name, net_wm_desktop, net_wm_window_type,
net_wm_state, net_wm_strut, net_wm_icon_geometry, net_wm_icon, net_wm_pid, net_wm_state, net_wm_strut, net_wm_icon_geometry, net_wm_icon, net_wm_pid,
net_wm_handled_icons; net_wm_handled_icons;
// application protocols // application protocols
Atom net_wm_ping; Atom net_wm_ping;
#endif // NEWWMSPEC #endif // NEWWMSPEC
@ -333,17 +333,17 @@ private:
#endif // GNOME #endif // GNOME
Bool _startup, _shutdown; bool m_startup, m_shutdown;
Display *display; Display *m_display;
LinkedList<ScreenInfo> *screenInfoList; LinkedList<ScreenInfo> *screenInfoList;
LinkedList<BTimer> *timerList; LinkedList<BTimer> *timerList;
char *display_name, *application_name; char *m_display_name, *m_app_name;
int number_of_screens, server_grabs, colors_per_channel; int number_of_screens, m_server_grabs, colors_per_channel;
protected: protected:
virtual void process_event(XEvent *) = 0; virtual void process_event(XEvent *) = 0;
}; };
@ -351,28 +351,28 @@ protected:
class ScreenInfo { class ScreenInfo {
public: public:
ScreenInfo(BaseDisplay *, int); ScreenInfo(BaseDisplay *, int);
inline BaseDisplay *getBaseDisplay(void) { return basedisplay; } inline BaseDisplay *getBaseDisplay(void) { return basedisplay; }
inline Visual *getVisual(void) { return visual; } inline Visual *getVisual(void) { return visual; }
inline const Window &getRootWindow(void) const { return root_window; } inline const Window &getRootWindow(void) const { return root_window; }
inline const Colormap &getColormap(void) const { return colormap; } inline const Colormap &getColormap(void) const { return colormap; }
inline const int &getDepth(void) const { return depth; } inline const int &getDepth(void) const { return depth; }
inline const int &getScreenNumber(void) const { return screen_number; } inline const int &getScreenNumber(void) const { return screen_number; }
inline const unsigned int &getWidth(void) const { return width; } inline const unsigned int &getWidth(void) const { return width; }
inline const unsigned int &getHeight(void) const { return height; } inline const unsigned int &getHeight(void) const { return height; }
private: private:
BaseDisplay *basedisplay; BaseDisplay *basedisplay;
Visual *visual; Visual *visual;
Window root_window; Window root_window;
Colormap colormap; Colormap colormap;
int depth, screen_number; int depth, screen_number;
unsigned int width, height; unsigned int width, height;
}; };