indentation
This commit is contained in:
parent
53ad4872bd
commit
2652479b7c
2 changed files with 518 additions and 521 deletions
|
@ -22,10 +22,9 @@
|
||||||
// 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
|
||||||
|
@ -34,8 +33,9 @@
|
||||||
# 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>
|
||||||
|
|
||||||
|
@ -43,10 +43,6 @@
|
||||||
# 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>
|
||||||
|
@ -91,7 +87,6 @@
|
||||||
# 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
|
||||||
static Bool internal_error = False;
|
static Bool internal_error = False;
|
||||||
|
@ -115,6 +110,7 @@ static int handleXErrors(Display *d, XErrorEvent *e) {
|
||||||
"%s: X error: %s(%d) opcodes %d/%d\n resource 0x%lx\n"),
|
"%s: X error: %s(%d) opcodes %d/%d\n resource 0x%lx\n"),
|
||||||
base_display->getApplicationName(), errtxt, e->error_code,
|
base_display->getApplicationName(), errtxt, e->error_code,
|
||||||
e->request_code, e->minor_code, e->resourceid);
|
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
|
||||||
|
@ -219,12 +215,12 @@ void bexec(const char *command, char* displaystring) {
|
||||||
#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;
|
||||||
|
@ -255,7 +251,7 @@ 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(
|
||||||
|
@ -265,8 +261,9 @@ BaseDisplay::BaseDisplay(char *app_name, char *dpy_name) {
|
||||||
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(
|
||||||
|
@ -280,11 +277,10 @@ BaseDisplay::BaseDisplay(char *app_name, char *dpy_name) {
|
||||||
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;
|
||||||
|
@ -292,99 +288,99 @@ BaseDisplay::BaseDisplay(char *app_name, char *dpy_name) {
|
||||||
//---------- 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);
|
||||||
|
|
||||||
|
@ -417,18 +413,18 @@ BaseDisplay::~BaseDisplay(void) {
|
||||||
|
|
||||||
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
|
||||||
|
@ -513,29 +509,28 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -544,11 +539,12 @@ void BaseDisplay::addTimer(BTimer *timer) {
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
@ -585,6 +581,7 @@ ScreenInfo::ScreenInfo(BaseDisplay *d, int num) {
|
||||||
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++) {
|
for (int i = 0; i < vinfo_nitems; i++) {
|
||||||
if (depth < (vinfo_return + i)->depth) {
|
if (depth < (vinfo_return + i)->depth) {
|
||||||
depth = (vinfo_return + i)->depth;
|
depth = (vinfo_return + i)->depth;
|
||||||
|
|
|
@ -22,22 +22,21 @@
|
||||||
// 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>
|
||||||
|
|
||||||
// forward declaration
|
// forward declaration
|
||||||
class ScreenInfo;
|
class ScreenInfo;
|
||||||
|
|
||||||
#include "LinkedList.hh"
|
|
||||||
#include "Timer.hh"
|
|
||||||
#include "NotCopyable.hh"
|
|
||||||
|
|
||||||
|
|
||||||
#define PropBlackboxHintsElements (5)
|
#define PropBlackboxHintsElements (5)
|
||||||
#define PropBlackboxAttributesElements (8)
|
#define PropBlackboxAttributesElements (8)
|
||||||
|
|
||||||
|
@ -49,7 +48,8 @@ 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);
|
||||||
|
@ -217,10 +217,10 @@ public:
|
||||||
|
|
||||||
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; }
|
||||||
|
@ -231,22 +231,22 @@ public:
|
||||||
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);
|
||||||
|
@ -333,13 +333,13 @@ 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:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue