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,346 +121,346 @@ static int handleXErrors(Display *d, XErrorEvent *e) {
|
||||||
// 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
|
||||||
|
{
|
||||||
|
static int re_enter = 0;
|
||||||
|
|
||||||
static int re_enter = 0;
|
switch (sig) {
|
||||||
|
case SIGCHLD:
|
||||||
switch (sig) {
|
int status;
|
||||||
case SIGCHLD:
|
waitpid(-1, &status, WNOHANG | WUNTRACED);
|
||||||
int status;
|
|
||||||
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);
|
|
||||||
#endif // HAVE_SIGACTION
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
if (base_display->handleSignal(sig)) {
|
|
||||||
|
|
||||||
#ifndef HAVE_SIGACTION
|
|
||||||
// assume broken, braindead sysv signal semantics
|
|
||||||
signal(sig, (RETSIGTYPE (*)(int)) signalhandler);
|
|
||||||
#endif // HAVE_SIGACTION
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(stderr, i18n(BaseDisplaySet, BaseDisplaySignalCaught,
|
|
||||||
"%s: signal %d caught\n"),
|
|
||||||
base_display->getApplicationName(), sig);
|
|
||||||
|
|
||||||
if (! base_display->isStartup() && ! re_enter) {
|
|
||||||
internal_error = True;
|
|
||||||
|
|
||||||
re_enter = 1;
|
|
||||||
fprintf(stderr, i18n(BaseDisplaySet, BaseDisplayShuttingDown,
|
|
||||||
"shutting down\n"));
|
|
||||||
base_display->shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sig != SIGTERM && sig != SIGINT) {
|
|
||||||
fprintf(stderr, i18n(BaseDisplaySet, BaseDisplayAborting,
|
|
||||||
"aborting... dumping core\n"));
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
exit(0);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// convenience functions
|
|
||||||
#ifndef __EMX__
|
|
||||||
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) {
|
|
||||||
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) {
|
|
||||||
application_name = bstrdup(app_name);
|
|
||||||
|
|
||||||
_startup = True;
|
|
||||||
_shutdown = False;
|
|
||||||
server_grabs = 0;
|
|
||||||
last_bad_window = None;
|
|
||||||
|
|
||||||
::base_display = this;
|
|
||||||
|
|
||||||
#ifdef HAVE_SIGACTION
|
|
||||||
struct sigaction action;
|
|
||||||
|
|
||||||
action.sa_handler = signalhandler;
|
|
||||||
action.sa_mask = sigset_t();
|
|
||||||
action.sa_flags = SA_NOCLDSTOP | SA_NODEFER;
|
|
||||||
|
|
||||||
sigaction(SIGPIPE, &action, NULL);
|
|
||||||
sigaction(SIGSEGV, &action, NULL);
|
|
||||||
sigaction(SIGFPE, &action, NULL);
|
|
||||||
sigaction(SIGTERM, &action, NULL);
|
|
||||||
sigaction(SIGINT, &action, NULL);
|
|
||||||
sigaction(SIGCHLD, &action, NULL);
|
|
||||||
sigaction(SIGHUP, &action, NULL);
|
|
||||||
sigaction(SIGUSR1, &action, NULL);
|
|
||||||
sigaction(SIGUSR2, &action, NULL);
|
|
||||||
#else // !HAVE_SIGACTION
|
|
||||||
signal(SIGPIPE, (RETSIGTYPE (*)(int)) signalhandler);
|
|
||||||
signal(SIGSEGV, (RETSIGTYPE (*)(int)) signalhandler);
|
|
||||||
signal(SIGFPE, (RETSIGTYPE (*)(int)) signalhandler);
|
|
||||||
signal(SIGTERM, (RETSIGTYPE (*)(int)) signalhandler);
|
|
||||||
signal(SIGINT, (RETSIGTYPE (*)(int)) signalhandler);
|
|
||||||
signal(SIGUSR1, (RETSIGTYPE (*)(int)) signalhandler);
|
|
||||||
signal(SIGUSR2, (RETSIGTYPE (*)(int)) signalhandler);
|
|
||||||
signal(SIGHUP, (RETSIGTYPE (*)(int)) signalhandler);
|
|
||||||
signal(SIGCHLD, (RETSIGTYPE (*)(int)) signalhandler);
|
signal(SIGCHLD, (RETSIGTYPE (*)(int)) signalhandler);
|
||||||
#endif // HAVE_SIGACTION
|
#endif // HAVE_SIGACTION
|
||||||
|
|
||||||
if (! (display = XOpenDisplay(dpy_name))) {
|
break;
|
||||||
fprintf(stderr, i18n(BaseDisplaySet, BaseDisplayXConnectFail,
|
|
||||||
"BaseDisplay::BaseDisplay: connection to X server failed.\n"));
|
default:
|
||||||
::exit(2);
|
if (base_display->handleSignal(sig)) {
|
||||||
} else if (fcntl(ConnectionNumber(display), F_SETFD, 1) == -1) {
|
|
||||||
fprintf(stderr,
|
#ifndef HAVE_SIGACTION
|
||||||
i18n(BaseDisplaySet, BaseDisplayCloseOnExecFail,
|
// assume broken, braindead sysv signal semantics
|
||||||
"BaseDisplay::BaseDisplay: couldn't mark display connection "
|
signal(sig, (RETSIGTYPE (*)(int)) signalhandler);
|
||||||
"as close-on-exec\n"));
|
#endif // HAVE_SIGACTION
|
||||||
::exit(2);
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
display_name = XDisplayName(dpy_name);
|
fprintf(stderr, i18n(BaseDisplaySet, BaseDisplaySignalCaught,
|
||||||
|
"%s: signal %d caught\n"),
|
||||||
|
base_display->getApplicationName(), sig);
|
||||||
|
|
||||||
|
if (! base_display->isStartup() && ! re_enter) {
|
||||||
|
internal_error = True;
|
||||||
|
|
||||||
|
re_enter = 1;
|
||||||
|
fprintf(stderr, i18n(BaseDisplaySet, BaseDisplayShuttingDown,
|
||||||
|
"shutting down\n"));
|
||||||
|
base_display->shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sig != SIGTERM && sig != SIGINT) {
|
||||||
|
fprintf(stderr, i18n(BaseDisplaySet, BaseDisplayAborting,
|
||||||
|
"aborting... dumping core\n"));
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// convenience functions
|
||||||
|
#ifndef __EMX__
|
||||||
|
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) {
|
||||||
|
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) {
|
||||||
|
application_name = bstrdup(app_name);
|
||||||
|
|
||||||
|
_startup = True;
|
||||||
|
_shutdown = False;
|
||||||
|
server_grabs = 0;
|
||||||
|
last_bad_window = None;
|
||||||
|
|
||||||
|
::base_display = this;
|
||||||
|
|
||||||
|
#ifdef HAVE_SIGACTION
|
||||||
|
struct sigaction action;
|
||||||
|
|
||||||
|
action.sa_handler = signalhandler;
|
||||||
|
action.sa_mask = sigset_t();
|
||||||
|
action.sa_flags = SA_NOCLDSTOP | SA_NODEFER;
|
||||||
|
|
||||||
|
sigaction(SIGPIPE, &action, NULL);
|
||||||
|
sigaction(SIGSEGV, &action, NULL);
|
||||||
|
sigaction(SIGFPE, &action, NULL);
|
||||||
|
sigaction(SIGTERM, &action, NULL);
|
||||||
|
sigaction(SIGINT, &action, NULL);
|
||||||
|
sigaction(SIGCHLD, &action, NULL);
|
||||||
|
sigaction(SIGHUP, &action, NULL);
|
||||||
|
sigaction(SIGUSR1, &action, NULL);
|
||||||
|
sigaction(SIGUSR2, &action, NULL);
|
||||||
|
#else // !HAVE_SIGACTION
|
||||||
|
signal(SIGPIPE, (RETSIGTYPE (*)(int)) signalhandler);
|
||||||
|
signal(SIGSEGV, (RETSIGTYPE (*)(int)) signalhandler);
|
||||||
|
signal(SIGFPE, (RETSIGTYPE (*)(int)) signalhandler);
|
||||||
|
signal(SIGTERM, (RETSIGTYPE (*)(int)) signalhandler);
|
||||||
|
signal(SIGINT, (RETSIGTYPE (*)(int)) signalhandler);
|
||||||
|
signal(SIGUSR1, (RETSIGTYPE (*)(int)) signalhandler);
|
||||||
|
signal(SIGUSR2, (RETSIGTYPE (*)(int)) signalhandler);
|
||||||
|
signal(SIGHUP, (RETSIGTYPE (*)(int)) signalhandler);
|
||||||
|
signal(SIGCHLD, (RETSIGTYPE (*)(int)) signalhandler);
|
||||||
|
#endif // HAVE_SIGACTION
|
||||||
|
|
||||||
|
if (! (display = XOpenDisplay(dpy_name))) {
|
||||||
|
fprintf(stderr, i18n(BaseDisplaySet, BaseDisplayXConnectFail,
|
||||||
|
"BaseDisplay::BaseDisplay: connection to X server failed.\n"));
|
||||||
|
::exit(2);
|
||||||
|
} else if (fcntl(ConnectionNumber(display), F_SETFD, 1) == -1) {
|
||||||
|
fprintf(stderr,
|
||||||
|
i18n(BaseDisplaySet, BaseDisplayCloseOnExecFail,
|
||||||
|
"BaseDisplay::BaseDisplay: couldn't mark display connection "
|
||||||
|
"as close-on-exec\n"));
|
||||||
|
::exit(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
display_name = XDisplayName(dpy_name);
|
||||||
|
|
||||||
#ifdef SHAPE
|
#ifdef SHAPE
|
||||||
shape.extensions = XShapeQueryExtension(display, &shape.event_basep,
|
shape.extensions = XShapeQueryExtension(display, &shape.event_basep,
|
||||||
&shape.error_basep);
|
&shape.error_basep);
|
||||||
#else // !SHAPE
|
#else // !SHAPE
|
||||||
shape.extensions = False;
|
shape.extensions = False;
|
||||||
#endif // SHAPE
|
#endif // SHAPE
|
||||||
|
|
||||||
xa_wm_colormap_windows =
|
xa_wm_colormap_windows =
|
||||||
XInternAtom(display, "WM_COLORMAP_WINDOWS", False);
|
XInternAtom(display, "WM_COLORMAP_WINDOWS", False);
|
||||||
xa_wm_protocols = XInternAtom(display, "WM_PROTOCOLS", False);
|
xa_wm_protocols = XInternAtom(display, "WM_PROTOCOLS", False);
|
||||||
xa_wm_state = XInternAtom(display, "WM_STATE", False);
|
xa_wm_state = XInternAtom(display, "WM_STATE", False);
|
||||||
xa_wm_change_state = XInternAtom(display, "WM_CHANGE_STATE", False);
|
xa_wm_change_state = XInternAtom(display, "WM_CHANGE_STATE", False);
|
||||||
xa_wm_delete_window = XInternAtom(display, "WM_DELETE_WINDOW", False);
|
xa_wm_delete_window = XInternAtom(display, "WM_DELETE_WINDOW", False);
|
||||||
xa_wm_take_focus = XInternAtom(display, "WM_TAKE_FOCUS", False);
|
xa_wm_take_focus = XInternAtom(display, "WM_TAKE_FOCUS", False);
|
||||||
motif_wm_hints = XInternAtom(display, "_MOTIF_WM_HINTS", False);
|
motif_wm_hints = XInternAtom(display, "_MOTIF_WM_HINTS", False);
|
||||||
|
|
||||||
openbox_hints = XInternAtom(display, "_BLACKBOX_HINTS", False);
|
openbox_hints = XInternAtom(display, "_BLACKBOX_HINTS", False);
|
||||||
openbox_attributes = XInternAtom(display, "_BLACKBOX_ATTRIBUTES", False);
|
openbox_attributes = XInternAtom(display, "_BLACKBOX_ATTRIBUTES", False);
|
||||||
openbox_change_attributes =
|
openbox_change_attributes =
|
||||||
XInternAtom(display, "_BLACKBOX_CHANGE_ATTRIBUTES", False);
|
XInternAtom(display, "_BLACKBOX_CHANGE_ATTRIBUTES", False);
|
||||||
|
|
||||||
openbox_structure_messages =
|
openbox_structure_messages =
|
||||||
XInternAtom(display, "_BLACKBOX_STRUCTURE_MESSAGES", False);
|
XInternAtom(display, "_BLACKBOX_STRUCTURE_MESSAGES", False);
|
||||||
openbox_notify_startup =
|
openbox_notify_startup =
|
||||||
XInternAtom(display, "_BLACKBOX_NOTIFY_STARTUP", False);
|
XInternAtom(display, "_BLACKBOX_NOTIFY_STARTUP", False);
|
||||||
openbox_notify_window_add =
|
openbox_notify_window_add =
|
||||||
XInternAtom(display, "_BLACKBOX_NOTIFY_WINDOW_ADD", False);
|
XInternAtom(display, "_BLACKBOX_NOTIFY_WINDOW_ADD", False);
|
||||||
openbox_notify_window_del =
|
openbox_notify_window_del =
|
||||||
XInternAtom(display, "_BLACKBOX_NOTIFY_WINDOW_DEL", False);
|
XInternAtom(display, "_BLACKBOX_NOTIFY_WINDOW_DEL", False);
|
||||||
openbox_notify_current_workspace =
|
openbox_notify_current_workspace =
|
||||||
XInternAtom(display, "_BLACKBOX_NOTIFY_CURRENT_WORKSPACE", False);
|
XInternAtom(display, "_BLACKBOX_NOTIFY_CURRENT_WORKSPACE", False);
|
||||||
openbox_notify_workspace_count =
|
openbox_notify_workspace_count =
|
||||||
XInternAtom(display, "_BLACKBOX_NOTIFY_WORKSPACE_COUNT", False);
|
XInternAtom(display, "_BLACKBOX_NOTIFY_WORKSPACE_COUNT", False);
|
||||||
openbox_notify_window_focus =
|
openbox_notify_window_focus =
|
||||||
XInternAtom(display, "_BLACKBOX_NOTIFY_WINDOW_FOCUS", False);
|
XInternAtom(display, "_BLACKBOX_NOTIFY_WINDOW_FOCUS", False);
|
||||||
openbox_notify_window_raise =
|
openbox_notify_window_raise =
|
||||||
XInternAtom(display, "_BLACKBOX_NOTIFY_WINDOW_RAISE", False);
|
XInternAtom(display, "_BLACKBOX_NOTIFY_WINDOW_RAISE", False);
|
||||||
openbox_notify_window_lower =
|
openbox_notify_window_lower =
|
||||||
XInternAtom(display, "_BLACKBOX_NOTIFY_WINDOW_LOWER", False);
|
XInternAtom(display, "_BLACKBOX_NOTIFY_WINDOW_LOWER", False);
|
||||||
|
|
||||||
openbox_change_workspace =
|
openbox_change_workspace =
|
||||||
XInternAtom(display, "_BLACKBOX_CHANGE_WORKSPACE", False);
|
XInternAtom(display, "_BLACKBOX_CHANGE_WORKSPACE", False);
|
||||||
openbox_change_window_focus =
|
openbox_change_window_focus =
|
||||||
XInternAtom(display, "_BLACKBOX_CHANGE_WINDOW_FOCUS", False);
|
XInternAtom(display, "_BLACKBOX_CHANGE_WINDOW_FOCUS", False);
|
||||||
openbox_cycle_window_focus =
|
openbox_cycle_window_focus =
|
||||||
XInternAtom(display, "_BLACKBOX_CYCLE_WINDOW_FOCUS", False);
|
XInternAtom(display, "_BLACKBOX_CYCLE_WINDOW_FOCUS", False);
|
||||||
|
|
||||||
#ifdef NEWWMSPEC
|
#ifdef NEWWMSPEC
|
||||||
|
|
||||||
net_supported = XInternAtom(display, "_NET_SUPPORTED", False);
|
net_supported = XInternAtom(display, "_NET_SUPPORTED", False);
|
||||||
net_client_list = XInternAtom(display, "_NET_CLIENT_LIST", False);
|
net_client_list = XInternAtom(display, "_NET_CLIENT_LIST", False);
|
||||||
net_client_list_stacking = XInternAtom(display, "_NET_CLIENT_LIST_STACKING", False);
|
net_client_list_stacking = XInternAtom(display, "_NET_CLIENT_LIST_STACKING", False);
|
||||||
net_number_of_desktops = XInternAtom(display, "_NET_NUMBER_OF_DESKTOPS", False);
|
net_number_of_desktops = XInternAtom(display, "_NET_NUMBER_OF_DESKTOPS", False);
|
||||||
net_desktop_geometry = XInternAtom(display, "_NET_DESKTOP_GEOMETRY", False);
|
net_desktop_geometry = XInternAtom(display, "_NET_DESKTOP_GEOMETRY", False);
|
||||||
net_desktop_viewport = XInternAtom(display, "_NET_DESKTOP_VIEWPORT", False);
|
net_desktop_viewport = XInternAtom(display, "_NET_DESKTOP_VIEWPORT", False);
|
||||||
net_current_desktop = XInternAtom(display, "_NET_CURRENT_DESKTOP", False);
|
net_current_desktop = XInternAtom(display, "_NET_CURRENT_DESKTOP", False);
|
||||||
net_desktop_names = XInternAtom(display, "_NET_DESKTOP_NAMES", False);
|
net_desktop_names = XInternAtom(display, "_NET_DESKTOP_NAMES", False);
|
||||||
net_active_window = XInternAtom(display, "_NET_ACTIVE_WINDOW", False);
|
net_active_window = XInternAtom(display, "_NET_ACTIVE_WINDOW", False);
|
||||||
net_workarea = XInternAtom(display, "_NET_WORKAREA", False);
|
net_workarea = XInternAtom(display, "_NET_WORKAREA", False);
|
||||||
net_supporting_wm_check = XInternAtom(display, "_NET_SUPPORTING_WM_CHECK", False);
|
net_supporting_wm_check = XInternAtom(display, "_NET_SUPPORTING_WM_CHECK", False);
|
||||||
net_virtual_roots = XInternAtom(display, "_NET_VIRTUAL_ROOTS", False);
|
net_virtual_roots = XInternAtom(display, "_NET_VIRTUAL_ROOTS", False);
|
||||||
|
|
||||||
net_close_window = XInternAtom(display, "_NET_CLOSE_WINDOW", False);
|
net_close_window = XInternAtom(display, "_NET_CLOSE_WINDOW", False);
|
||||||
net_wm_moveresize = XInternAtom(display, "_NET_WM_MOVERESIZE", False);
|
net_wm_moveresize = XInternAtom(display, "_NET_WM_MOVERESIZE", False);
|
||||||
|
|
||||||
net_properties = XInternAtom(display, "_NET_PROPERTIES", False);
|
net_properties = XInternAtom(display, "_NET_PROPERTIES", False);
|
||||||
net_wm_name = XInternAtom(display, "_NET_WM_NAME", False);
|
net_wm_name = XInternAtom(display, "_NET_WM_NAME", False);
|
||||||
net_wm_desktop = XInternAtom(display, "_NET_WM_DESKTOP", False);
|
net_wm_desktop = XInternAtom(display, "_NET_WM_DESKTOP", False);
|
||||||
net_wm_window_type = XInternAtom(display, "_NET_WM_WINDOW_TYPE", False);
|
net_wm_window_type = XInternAtom(display, "_NET_WM_WINDOW_TYPE", False);
|
||||||
net_wm_state = XInternAtom(display, "_NET_WM_STATE", False);
|
net_wm_state = XInternAtom(display, "_NET_WM_STATE", False);
|
||||||
net_wm_strut = XInternAtom(display, "_NET_WM_STRUT", False);
|
net_wm_strut = XInternAtom(display, "_NET_WM_STRUT", False);
|
||||||
net_wm_icon_geometry = XInternAtom(display, "_NET_WM_ICON_GEOMETRY", False);
|
net_wm_icon_geometry = XInternAtom(display, "_NET_WM_ICON_GEOMETRY", False);
|
||||||
net_wm_icon = XInternAtom(display, "_NET_WM_ICON", False);
|
net_wm_icon = XInternAtom(display, "_NET_WM_ICON", False);
|
||||||
net_wm_pid = XInternAtom(display, "_NET_WM_PID", False);
|
net_wm_pid = XInternAtom(display, "_NET_WM_PID", False);
|
||||||
net_wm_handled_icons = XInternAtom(display, "_NET_WM_HANDLED_ICONS", False);
|
net_wm_handled_icons = XInternAtom(display, "_NET_WM_HANDLED_ICONS", False);
|
||||||
|
|
||||||
net_wm_ping = XInternAtom(display, "_NET_WM_PING", False);
|
net_wm_ping = XInternAtom(display, "_NET_WM_PING", False);
|
||||||
|
|
||||||
#endif // NEWWMSPEC
|
#endif // NEWWMSPEC
|
||||||
|
|
||||||
cursor.session = XCreateFontCursor(display, XC_left_ptr);
|
cursor.session = XCreateFontCursor(display, XC_left_ptr);
|
||||||
cursor.move = XCreateFontCursor(display, XC_fleur);
|
cursor.move = XCreateFontCursor(display, XC_fleur);
|
||||||
cursor.ll_angle = XCreateFontCursor(display, XC_ll_angle);
|
cursor.ll_angle = XCreateFontCursor(display, XC_ll_angle);
|
||||||
cursor.lr_angle = XCreateFontCursor(display, XC_lr_angle);
|
cursor.lr_angle = XCreateFontCursor(display, XC_lr_angle);
|
||||||
cursor.ul_angle = XCreateFontCursor(display, XC_ul_angle);
|
cursor.ul_angle = XCreateFontCursor(display, XC_ul_angle);
|
||||||
cursor.ur_angle = XCreateFontCursor(display, XC_ur_angle);
|
cursor.ur_angle = XCreateFontCursor(display, XC_ur_angle);
|
||||||
|
|
||||||
XSetErrorHandler((XErrorHandler) handleXErrors);
|
XSetErrorHandler((XErrorHandler) handleXErrors);
|
||||||
|
|
||||||
screenInfoList.reserve(numberOfScreens());
|
screenInfoList.reserve(numberOfScreens());
|
||||||
for (unsigned int s = 0; s < numberOfScreens(); s++)
|
for (unsigned int s = 0; s < numberOfScreens(); s++)
|
||||||
screenInfoList.push_back(new ScreenInfo(*this, s));
|
screenInfoList.push_back(new ScreenInfo(*this, s));
|
||||||
|
|
||||||
#ifndef NOCLOBBER
|
#ifndef NOCLOBBER
|
||||||
NumLockMask = ScrollLockMask = 0;
|
NumLockMask = ScrollLockMask = 0;
|
||||||
|
|
||||||
const XModifierKeymap* const modmap = XGetModifierMapping(display);
|
const XModifierKeymap* const modmap = XGetModifierMapping(display);
|
||||||
if (modmap && modmap->max_keypermod > 0) {
|
if (modmap && modmap->max_keypermod > 0) {
|
||||||
const int mask_table[] = {
|
const int mask_table[] = {
|
||||||
ShiftMask, LockMask, ControlMask, Mod1Mask,
|
ShiftMask, LockMask, ControlMask, Mod1Mask,
|
||||||
Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask
|
Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask
|
||||||
};
|
};
|
||||||
const size_t size = (sizeof(mask_table) / sizeof(mask_table[0])) *
|
const size_t size = (sizeof(mask_table) / sizeof(mask_table[0])) *
|
||||||
modmap->max_keypermod;
|
modmap->max_keypermod;
|
||||||
// get the values of the keyboard lock modifiers
|
// get the values of the keyboard lock modifiers
|
||||||
// Note: Caps lock is not retrieved the same way as Scroll and Num lock
|
// Note: Caps lock is not retrieved the same way as Scroll and Num lock
|
||||||
// since it doesn't need to be.
|
// since it doesn't need to be.
|
||||||
const KeyCode num_lock_code = XKeysymToKeycode(display, XK_Num_Lock);
|
const KeyCode num_lock_code = XKeysymToKeycode(display, XK_Num_Lock);
|
||||||
const KeyCode scroll_lock_code = XKeysymToKeycode(display, XK_Scroll_Lock);
|
const KeyCode scroll_lock_code = XKeysymToKeycode(display, XK_Scroll_Lock);
|
||||||
|
|
||||||
for (size_t cnt = 0; cnt < size; ++cnt) {
|
for (size_t cnt = 0; cnt < size; ++cnt) {
|
||||||
if (! modmap->modifiermap[cnt]) continue;
|
if (! modmap->modifiermap[cnt]) continue;
|
||||||
|
|
||||||
if (num_lock_code == modmap->modifiermap[cnt])
|
if (num_lock_code == modmap->modifiermap[cnt])
|
||||||
NumLockMask = mask_table[cnt / modmap->max_keypermod];
|
NumLockMask = mask_table[cnt / modmap->max_keypermod];
|
||||||
if (scroll_lock_code == modmap->modifiermap[cnt])
|
if (scroll_lock_code == modmap->modifiermap[cnt])
|
||||||
ScrollLockMask = mask_table[cnt / modmap->max_keypermod];
|
ScrollLockMask = mask_table[cnt / modmap->max_keypermod];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MaskList[0] = 0;
|
MaskList[0] = 0;
|
||||||
MaskList[1] = LockMask;
|
MaskList[1] = LockMask;
|
||||||
MaskList[2] = NumLockMask;
|
MaskList[2] = NumLockMask;
|
||||||
MaskList[3] = ScrollLockMask;
|
MaskList[3] = ScrollLockMask;
|
||||||
MaskList[4] = LockMask | NumLockMask;
|
MaskList[4] = LockMask | NumLockMask;
|
||||||
MaskList[5] = NumLockMask | ScrollLockMask;
|
MaskList[5] = NumLockMask | ScrollLockMask;
|
||||||
MaskList[6] = LockMask | ScrollLockMask;
|
MaskList[6] = LockMask | ScrollLockMask;
|
||||||
MaskList[7] = LockMask | NumLockMask | ScrollLockMask;
|
MaskList[7] = LockMask | NumLockMask | ScrollLockMask;
|
||||||
MaskListLength = sizeof(MaskList) / sizeof(MaskList[0]);
|
MaskListLength = sizeof(MaskList) / sizeof(MaskList[0]);
|
||||||
|
|
||||||
if (modmap) XFreeModifiermap(const_cast<XModifierKeymap*>(modmap));
|
if (modmap) XFreeModifiermap(const_cast<XModifierKeymap*>(modmap));
|
||||||
#else
|
#else
|
||||||
NumLockMask = Mod2Mask;
|
NumLockMask = Mod2Mask;
|
||||||
ScrollLockMask = Mod5Mask;
|
ScrollLockMask = Mod5Mask;
|
||||||
#endif // NOCLOBBER
|
#endif // NOCLOBBER
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BaseDisplay::~BaseDisplay(void) {
|
BaseDisplay::~BaseDisplay(void) {
|
||||||
std::for_each(screenInfoList.begin(), screenInfoList.end(),
|
std::for_each(screenInfoList.begin(), screenInfoList.end(),
|
||||||
PointerAssassin());
|
PointerAssassin());
|
||||||
// we don't create the BTimers, we don't delete them
|
// we don't create the BTimers, we don't delete them
|
||||||
|
|
||||||
if (application_name != NULL)
|
if (application_name != NULL)
|
||||||
delete [] application_name;
|
delete [] application_name;
|
||||||
|
|
||||||
XCloseDisplay(display);
|
XCloseDisplay(display);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BaseDisplay::eventLoop(void) {
|
void BaseDisplay::eventLoop(void) {
|
||||||
run();
|
run();
|
||||||
|
|
||||||
int xfd = ConnectionNumber(display);
|
int xfd = ConnectionNumber(display);
|
||||||
|
|
||||||
while ((! _shutdown) && (! internal_error)) {
|
while ((! _shutdown) && (! internal_error)) {
|
||||||
if (XPending(display)) {
|
if (XPending(display)) {
|
||||||
XEvent e;
|
XEvent e;
|
||||||
XNextEvent(display, &e);
|
XNextEvent(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, i18n(BaseDisplaySet,
|
fprintf(stderr, i18n(BaseDisplaySet,
|
||||||
BaseDisplayBadWindowRemove,
|
BaseDisplayBadWindowRemove,
|
||||||
"BaseDisplay::eventLoop(): removing bad window "
|
"BaseDisplay::eventLoop(): removing bad window "
|
||||||
"from event queue\n"));
|
"from event queue\n"));
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
} else {
|
|
||||||
last_bad_window = None;
|
|
||||||
process_event(&e);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
fd_set rfds;
|
last_bad_window = None;
|
||||||
timeval now, tm, *timeout = (timeval *) 0;
|
process_event(&e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fd_set rfds;
|
||||||
|
timeval now, tm, *timeout = (timeval *) 0;
|
||||||
|
|
||||||
FD_ZERO(&rfds);
|
FD_ZERO(&rfds);
|
||||||
FD_SET(xfd, &rfds);
|
FD_SET(xfd, &rfds);
|
||||||
|
|
||||||
if (!timerList.empty()) {
|
if (!timerList.empty()) {
|
||||||
gettimeofday(&now, 0);
|
gettimeofday(&now, 0);
|
||||||
|
|
||||||
tm.tv_sec = tm.tv_usec = 0l;
|
tm.tv_sec = tm.tv_usec = 0l;
|
||||||
|
|
||||||
BTimer *timer = timerList.front();
|
BTimer *timer = timerList.front();
|
||||||
ASSERT(timer != NULL);
|
ASSERT(timer != NULL);
|
||||||
|
|
||||||
tm.tv_sec = timer->getStartTime().tv_sec +
|
tm.tv_sec = timer->getStartTime().tv_sec +
|
||||||
timer->getTimeout().tv_sec - now.tv_sec;
|
timer->getTimeout().tv_sec - now.tv_sec;
|
||||||
tm.tv_usec = timer->getStartTime().tv_usec +
|
tm.tv_usec = timer->getStartTime().tv_usec +
|
||||||
timer->getTimeout().tv_usec - now.tv_usec;
|
timer->getTimeout().tv_usec - now.tv_usec;
|
||||||
|
|
||||||
while (tm.tv_usec >= 1000000) {
|
while (tm.tv_usec >= 1000000) {
|
||||||
tm.tv_sec++;
|
tm.tv_sec++;
|
||||||
tm.tv_usec -= 1000000;
|
tm.tv_usec -= 1000000;
|
||||||
}
|
|
||||||
|
|
||||||
while (tm.tv_usec < 0) {
|
|
||||||
if (tm.tv_sec > 0) {
|
|
||||||
tm.tv_sec--;
|
|
||||||
tm.tv_usec += 1000000;
|
|
||||||
} else {
|
|
||||||
tm.tv_usec = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
timeout = &tm;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
select(xfd + 1, &rfds, 0, 0, timeout);
|
while (tm.tv_usec < 0) {
|
||||||
|
if (tm.tv_sec > 0) {
|
||||||
|
tm.tv_sec--;
|
||||||
|
tm.tv_usec += 1000000;
|
||||||
|
} else {
|
||||||
|
tm.tv_usec = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// check for timer timeout
|
timeout = &tm;
|
||||||
gettimeofday(&now, 0);
|
}
|
||||||
|
|
||||||
|
select(xfd + 1, &rfds, 0, 0, timeout);
|
||||||
|
|
||||||
|
// check for timer timeout
|
||||||
|
gettimeofday(&now, 0);
|
||||||
|
|
||||||
TimerList::iterator it;
|
TimerList::iterator it;
|
||||||
for (it = timerList.begin(); it != timerList.end(); ++it) {
|
for (it = timerList.begin(); it != timerList.end(); ++it) {
|
||||||
|
@ -487,144 +487,138 @@ static RETSIGTYPE signalhandler(int sig) {
|
||||||
} else
|
} else
|
||||||
timer->stop();
|
timer->stop();
|
||||||
it = timerList.begin(); // we no longer have any idea if the iterator is
|
it = timerList.begin(); // we no longer have any idea if the iterator is
|
||||||
// valid, but what was at the front() is no
|
// valid, but what was at the front() is no
|
||||||
// longer.
|
// longer.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const Bool BaseDisplay::validateWindow(Window window) {
|
const Bool BaseDisplay::validateWindow(Window window) {
|
||||||
XEvent event;
|
XEvent event;
|
||||||
if (XCheckTypedWindowEvent(display, window, DestroyNotify, &event)) {
|
if (XCheckTypedWindowEvent(display, window, DestroyNotify, &event)) {
|
||||||
XPutBackEvent(display, &event);
|
XPutBackEvent(display, &event);
|
||||||
|
|
||||||
return False;
|
return False;
|
||||||
}
|
|
||||||
|
|
||||||
return True;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return True;
|
||||||
|
}
|
||||||
|
|
||||||
void BaseDisplay::grab(void) {
|
|
||||||
if (! server_grabs++)
|
void BaseDisplay::grab(void) {
|
||||||
XGrabServer(display);
|
if (! server_grabs++)
|
||||||
|
XGrabServer(display);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BaseDisplay::ungrab(void) {
|
||||||
|
if (! --server_grabs)
|
||||||
|
XUngrabServer(display);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BaseDisplay::addTimer(BTimer *timer) {
|
||||||
|
ASSERT(timer != (BTimer *) 0);
|
||||||
|
|
||||||
|
TimerList::iterator it;
|
||||||
|
for (it = timerList.begin(); it != timerList.end(); ++it) {
|
||||||
|
BTimer *tmp = *it;
|
||||||
|
if ((tmp->getTimeout().tv_sec > timer->getTimeout().tv_sec) ||
|
||||||
|
((tmp->getTimeout().tv_sec == timer->getTimeout().tv_sec) &&
|
||||||
|
(tmp->getTimeout().tv_usec >= timer->getTimeout().tv_usec)))
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
timerList.insert(it, timer);
|
||||||
void BaseDisplay::ungrab(void) {
|
}
|
||||||
if (! --server_grabs)
|
|
||||||
XUngrabServer(display);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void BaseDisplay::addTimer(BTimer *timer) {
|
|
||||||
ASSERT(timer != (BTimer *) 0);
|
|
||||||
|
|
||||||
TimerList::iterator it;
|
|
||||||
for (it = timerList.begin(); it != timerList.end(); ++it) {
|
|
||||||
BTimer *tmp = *it;
|
|
||||||
if ((tmp->getTimeout().tv_sec > timer->getTimeout().tv_sec) ||
|
|
||||||
((tmp->getTimeout().tv_sec == timer->getTimeout().tv_sec) &&
|
|
||||||
(tmp->getTimeout().tv_usec >= timer->getTimeout().tv_usec)))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
timerList.insert(it, timer);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void BaseDisplay::removeTimer(BTimer *timer) {
|
|
||||||
ASSERT(timer != (BTimer *) 0);
|
|
||||||
timerList.remove(timer);
|
|
||||||
}
|
|
||||||
|
|
||||||
<<<<<<< BaseDisplay.cc
|
|
||||||
=======
|
|
||||||
void BaseDisplay::removeTimer(BTimer *timer) {
|
void BaseDisplay::removeTimer(BTimer *timer) {
|
||||||
ASSERT(timer != (BTimer *) 0);
|
ASSERT(timer != (BTimer *) 0);
|
||||||
timerList.remove(timer);
|
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.
|
* 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,
|
*/
|
||||||
Window grab_window, Bool owner_events,
|
void BaseDisplay::grabButton(unsigned int button, unsigned int modifiers,
|
||||||
unsigned int event_mask, int pointer_mode,
|
Window grab_window, Bool owner_events,
|
||||||
int keybaord_mode, Window confine_to,
|
unsigned int event_mask, int pointer_mode,
|
||||||
Cursor cursor) const
|
int keybaord_mode, Window confine_to,
|
||||||
{
|
Cursor cursor) const
|
||||||
|
{
|
||||||
#ifndef NOCLOBBER
|
#ifndef NOCLOBBER
|
||||||
for (size_t cnt = 0; cnt < MaskListLength; ++cnt)
|
for (size_t cnt = 0; cnt < MaskListLength; ++cnt)
|
||||||
XGrabButton(display, button, modifiers | MaskList[cnt], grab_window,
|
XGrabButton(display, button, modifiers | MaskList[cnt], grab_window,
|
||||||
owner_events, event_mask, pointer_mode, keybaord_mode,
|
|
||||||
confine_to, cursor);
|
|
||||||
#else // NOCLOBBER
|
|
||||||
XGrabButton(display, button, modifiers, grab_window,
|
|
||||||
owner_events, event_mask, pointer_mode, keybaord_mode,
|
owner_events, event_mask, pointer_mode, keybaord_mode,
|
||||||
confine_to, cursor);
|
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,
|
|
||||||
Window grab_window) const {
|
|
||||||
#ifndef NOCLOBBER
|
|
||||||
for (size_t cnt = 0; cnt < MaskListLength; ++cnt)
|
|
||||||
XUngrabButton(display, button, modifiers | MaskList[cnt], grab_window);
|
|
||||||
#else // NOCLOBBER
|
#else // NOCLOBBER
|
||||||
XUngrabButton(display, button, modifiers, grab_window);
|
XGrabButton(display, button, modifiers, grab_window,
|
||||||
|
owner_events, event_mask, pointer_mode, keybaord_mode,
|
||||||
|
confine_to, cursor);
|
||||||
#endif // NOCLOBBER
|
#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,
|
||||||
|
Window grab_window) const {
|
||||||
|
#ifndef NOCLOBBER
|
||||||
|
for (size_t cnt = 0; cnt < MaskListLength; ++cnt)
|
||||||
|
XUngrabButton(display, button, modifiers | MaskList[cnt], grab_window);
|
||||||
|
#else // NOCLOBBER
|
||||||
|
XUngrabButton(display, button, modifiers, grab_window);
|
||||||
|
#endif // NOCLOBBER
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ScreenInfo::ScreenInfo(BaseDisplay &d, int num) : basedisplay(d),
|
ScreenInfo::ScreenInfo(BaseDisplay &d, int num) : 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);
|
||||||
|
|
||||||
m_size = Size(WidthOfScreen(ScreenOfDisplay(basedisplay.getXDisplay(),
|
m_size = Size(WidthOfScreen(ScreenOfDisplay(basedisplay.getXDisplay(),
|
||||||
screen_number)),
|
screen_number)),
|
||||||
HeightOfScreen(ScreenOfDisplay(basedisplay.getXDisplay(),
|
HeightOfScreen(ScreenOfDisplay(basedisplay.getXDisplay(),
|
||||||
screen_number)));
|
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++) {
|
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;
|
||||||
visual = (vinfo_return + i)->visual;
|
visual = (vinfo_return + i)->visual;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XFree(vinfo_return);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (visual) {
|
XFree(vinfo_return);
|
||||||
colormap = XCreateColormap(basedisplay.getXDisplay(), root_window,
|
|
||||||
visual, AllocNone);
|
|
||||||
} else {
|
|
||||||
visual = DefaultVisual(basedisplay.getXDisplay(), screen_number);
|
|
||||||
colormap = DefaultColormap(basedisplay.getXDisplay(), screen_number);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (visual) {
|
||||||
|
colormap = XCreateColormap(basedisplay.getXDisplay(), root_window,
|
||||||
|
visual, AllocNone);
|
||||||
|
} else {
|
||||||
|
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
|
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
|
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 \
|
Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \
|
||||||
Clientmenu.h Workspace.h Rootmenu.h Screen.h Configmenu.h \
|
Clientmenu.h Workspace.h Rootmenu.h Screen.h Configmenu.h \
|
||||||
Netizen.h Workspacemenu.h Toolbar.h Resource.h Geometry.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
|
XAtom.o: XAtom.cc XAtom.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
|
|
||||||
Window.o: Window.cc i18n.h openbox.h BaseDisplay.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 \
|
Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \
|
||||||
Screen.h Configmenu.h Netizen.h Rootmenu.h Workspace.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.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#include "XAtom.h"
|
#include "XAtom.h"
|
||||||
#include "XDisplay.h"
|
#include "openbox.h"
|
||||||
#include "XScreen.h"
|
#include "Screen.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
|
|
||||||
XAtom::XAtom(const XDisplay *display) {
|
XAtom::XAtom(Openbox &ob) {
|
||||||
_display = display->_display;
|
_display = ob.getXDisplay();
|
||||||
|
|
||||||
#ifdef HAVE_GETPID
|
#ifdef HAVE_GETPID
|
||||||
openbox_pid = getAtom("_BLACKBOX_PID");
|
openbox_pid = getAtom("_BLACKBOX_PID");
|
||||||
|
@ -86,8 +86,8 @@ XAtom::XAtom(const XDisplay *display) {
|
||||||
|
|
||||||
net_wm_ping = getAtom("_NET_WM_PING");
|
net_wm_ping = getAtom("_NET_WM_PING");
|
||||||
|
|
||||||
for (int s = 0, c = display->screenCount(); s < c; ++s)
|
for (unsigned int s = 0, c = ob.managedScreenCount(); s < c; ++s)
|
||||||
setSupported(display->screen(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.
|
* 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
|
// create the netwm support window
|
||||||
Window w = XCreateSimpleWindow(_display, screen->rootWindow(),
|
Window w = XCreateSimpleWindow(_display, screen->getRootWindow(),
|
||||||
0, 0, 1, 1, 0, 0, 0);
|
0, 0, 1, 1, 0, 0, 0);
|
||||||
ASSERT(w != None);
|
ASSERT(w != None);
|
||||||
_support_windows.push_back(w);
|
_support_windows.push_back(w);
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class XDisplay;
|
class Openbox;
|
||||||
class XScreen;
|
class ScreenInfo;
|
||||||
|
|
||||||
class XAtom {
|
class XAtom {
|
||||||
typedef std::vector<Window> SupportWindows;
|
typedef std::vector<Window> SupportWindows;
|
||||||
|
@ -102,7 +102,7 @@ class XAtom {
|
||||||
net_wm_ping;
|
net_wm_ping;
|
||||||
|
|
||||||
Atom getAtom(const char *name) const;
|
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,
|
void setValue(Window win, Atom atom, Atom type, unsigned char *data,
|
||||||
int size, int nelements, bool append) const;
|
int size, int nelements, bool append) const;
|
||||||
|
@ -114,7 +114,7 @@ class XAtom {
|
||||||
XAtom& operator=(const XAtom&);
|
XAtom& operator=(const XAtom&);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
XAtom(const XDisplay *display);
|
XAtom(Openbox &ob);
|
||||||
virtual ~XAtom();
|
virtual ~XAtom();
|
||||||
|
|
||||||
void setCardValue(Window win, Atom atom, long value) const; // 32-bit CARDINAL
|
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"));
|
"Openbox::Openbox: no managable screens found, aborting.\n"));
|
||||||
::exit(3);
|
::exit(3);
|
||||||
}
|
}
|
||||||
current_screen = screenList.front();
|
current_screen = screenList[0];
|
||||||
|
|
||||||
// save current settings and default values
|
// save current settings and default values
|
||||||
save();
|
save();
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
//forward declaration
|
//forward declaration
|
||||||
class BScreen;
|
class BScreen;
|
||||||
|
@ -115,7 +116,7 @@ private:
|
||||||
typedef std::list<MenuTimestamp*> MenuTimestampList;
|
typedef std::list<MenuTimestamp*> MenuTimestampList;
|
||||||
MenuTimestampList menuTimestamps;
|
MenuTimestampList menuTimestamps;
|
||||||
|
|
||||||
typedef std::list<BScreen*> ScreenList;
|
typedef std::vector<BScreen*> ScreenList;
|
||||||
ScreenList screenList;
|
ScreenList screenList;
|
||||||
|
|
||||||
BScreen *current_screen;
|
BScreen *current_screen;
|
||||||
|
@ -158,8 +159,14 @@ public:
|
||||||
OpenboxWindow *focusedWindow();
|
OpenboxWindow *focusedWindow();
|
||||||
void focusWindow(OpenboxWindow *w);
|
void focusWindow(OpenboxWindow *w);
|
||||||
|
|
||||||
BScreen *getScreen(int);
|
inline BScreen *getScreen(unsigned int s) {
|
||||||
|
ASSERT(s < screenList.size());
|
||||||
|
return screenList[s];
|
||||||
|
}
|
||||||
BScreen *searchScreen(Window);
|
BScreen *searchScreen(Window);
|
||||||
|
inline unsigned int managedScreenCount() const {
|
||||||
|
return screenList.size();
|
||||||
|
}
|
||||||
|
|
||||||
inline Resource &getConfig() {
|
inline Resource &getConfig() {
|
||||||
return config;
|
return config;
|
||||||
|
|
Loading…
Reference in a new issue