# Makefile.am for Openbox
-SUBDIRS = data doc nls src util
+SUBDIRS = data doc src util
MAINTAINERCLEANFILES = aclocal.m4 config.h.in configure Makefile.in stamp-h.in
uninstall-local:
+++ /dev/null
-Makefile
-Makefile.in
-blackbox-nls.hh
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
+++ /dev/null
-Makefile
-Makefile.in
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
+++ /dev/null
-Makefile
-Makefile.in
-Translation.m
-openbox.cat
-# src/Makefile.am for Blackbox - an X11 Window manager
-# Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# 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
-# DEALINGS IN THE SOFTWARE.
-
DEFAULT_MENU=$(pkgdatadir)/menu
DEFAULT_STYLE=$(pkgdatadir)/styles/mbdtex
-CPPFLAGS=@CPPFLAGS@ @DEBUG@ \
--DLOCALEPATH=\"$(pkgdatadir)/nls\" \
+CXXFLAGS=`pkg-config --cflags xft` @CXXFLAGS@ \
-DDEFAULTMENU=\"$(DEFAULT_MENU)\" \
--DDEFAULTSTYLE=\"$(DEFAULT_STYLE)\"
+-DDEFAULTSTYLE=\"$(DEFAULT_STYLE)\" \
+-Dmultibyte\(\)=True
+
+LDFLAGS=`pkg-config --libs xft`
bin_PROGRAMS= openbox
-openbox_SOURCES= BaseDisplay.cc Basemenu.cc Clientmenu.cc Color.cc Configmenu.cc Configuration.cc Font.cc GCCache.cc Iconmenu.cc Image.cc ImageControl.cc Netizen.cc Rootmenu.cc Screen.cc Slit.cc Texture.cc Timer.cc Toolbar.cc Util.cc Window.cc Windowmenu.cc Workspace.cc Workspacemenu.cc XAtom.cc blackbox.cc i18n.cc main.cc
+openbox_SOURCES= basedisplay.cc color.cc configuration.cc font.cc gccache.cc image.cc imagecontrol.cc screen.cc texture.cc timer.cc util.cc window.cc workspace.cc xatom.cc blackbox.cc main.cc
MAINTAINERCLEANFILES= Makefile.in
rm -f *\~ *.orig *.rej .\#*
# local dependencies
-
-BaseDisplay.o: BaseDisplay.cc i18n.hh ../nls/blackbox-nls.hh \
- BaseDisplay.hh Timer.hh Util.hh GCCache.hh Color.hh
-Basemenu.o: Basemenu.cc i18n.hh ../nls/blackbox-nls.hh blackbox.hh \
- BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh Basemenu.hh \
- Font.hh Screen.hh Color.hh Texture.hh Image.hh Configmenu.hh \
- Iconmenu.hh Netizen.hh Rootmenu.hh Workspace.hh Workspacemenu.hh \
- GCCache.hh
-Clientmenu.o: Clientmenu.cc blackbox.hh i18n.hh ../nls/blackbox-nls.hh \
- BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh \
- Clientmenu.hh Basemenu.hh Screen.hh Color.hh Texture.hh Image.hh \
- Configmenu.hh Iconmenu.hh Netizen.hh Rootmenu.hh Workspace.hh \
- Workspacemenu.hh Window.hh Windowmenu.hh
-Color.o: Color.cc Color.hh BaseDisplay.hh Timer.hh Util.hh
-Configmenu.o: Configmenu.cc i18n.hh ../nls/blackbox-nls.hh \
- Configmenu.hh Basemenu.hh Image.hh Timer.hh BaseDisplay.hh Util.hh \
- Color.hh Toolbar.hh Screen.hh Texture.hh Iconmenu.hh Netizen.hh \
- Rootmenu.hh Workspace.hh Workspacemenu.hh blackbox.hh \
- Configuration.hh XAtom.hh Window.hh Windowmenu.hh
-Configuration.o: Configuration.cc ../config.h Configuration.hh Util.hh
-Font.o: Font.cc i18n.hh ../nls/blackbox-nls.hh Font.hh Screen.hh \
- Color.hh Texture.hh Util.hh Image.hh Timer.hh BaseDisplay.hh \
- Configmenu.hh Basemenu.hh Iconmenu.hh Netizen.hh Rootmenu.hh \
- Workspace.hh Workspacemenu.hh blackbox.hh Configuration.hh XAtom.hh \
- GCCache.hh
-GCCache.o: GCCache.cc GCCache.hh BaseDisplay.hh Timer.hh Util.hh \
- Color.hh
-Iconmenu.o: Iconmenu.cc i18n.hh ../nls/blackbox-nls.hh Iconmenu.hh \
- Basemenu.hh Screen.hh Color.hh Texture.hh Util.hh Image.hh Timer.hh \
- BaseDisplay.hh Configmenu.hh Netizen.hh Rootmenu.hh Workspace.hh \
- Workspacemenu.hh blackbox.hh Configuration.hh XAtom.hh Window.hh \
- Windowmenu.hh
-Image.o: Image.cc blackbox.hh i18n.hh ../nls/blackbox-nls.hh \
- BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh GCCache.hh \
- Color.hh Image.hh Texture.hh
-ImageControl.o: ImageControl.cc blackbox.hh i18n.hh \
- ../nls/blackbox-nls.hh BaseDisplay.hh Timer.hh Util.hh \
- Configuration.hh XAtom.hh Color.hh Image.hh Texture.hh
-Netizen.o: Netizen.cc Netizen.hh Screen.hh Color.hh Texture.hh Util.hh \
- Image.hh Timer.hh BaseDisplay.hh Configmenu.hh Basemenu.hh \
- Iconmenu.hh Rootmenu.hh Workspace.hh Workspacemenu.hh blackbox.hh \
- i18n.hh ../nls/blackbox-nls.hh Configuration.hh XAtom.hh
-Rootmenu.o: Rootmenu.cc blackbox.hh i18n.hh ../nls/blackbox-nls.hh \
- BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh Rootmenu.hh \
- Basemenu.hh Screen.hh Color.hh Texture.hh Image.hh Configmenu.hh \
- Iconmenu.hh Netizen.hh Workspace.hh Workspacemenu.hh
-Screen.o: Screen.cc ../config.h i18n.hh ../nls/blackbox-nls.hh \
- blackbox.hh BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh \
- Clientmenu.hh Basemenu.hh Font.hh Screen.hh Color.hh Texture.hh \
- Image.hh Configmenu.hh Iconmenu.hh Netizen.hh Rootmenu.hh \
- Workspace.hh Workspacemenu.hh GCCache.hh Slit.hh Toolbar.hh Window.hh \
- Windowmenu.hh
-Slit.o: Slit.cc i18n.hh ../nls/blackbox-nls.hh blackbox.hh \
- BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh Image.hh \
- Color.hh Screen.hh Texture.hh Configmenu.hh Basemenu.hh Iconmenu.hh \
- Netizen.hh Rootmenu.hh Workspace.hh Workspacemenu.hh Slit.hh \
- Toolbar.hh
-Texture.o: Texture.cc Texture.hh Color.hh Util.hh BaseDisplay.hh \
- Timer.hh Image.hh Screen.hh Configmenu.hh Basemenu.hh Iconmenu.hh \
- Netizen.hh Rootmenu.hh Workspace.hh Workspacemenu.hh blackbox.hh \
- i18n.hh ../nls/blackbox-nls.hh Configuration.hh XAtom.hh
-Timer.o: Timer.cc BaseDisplay.hh Timer.hh Util.hh
-Toolbar.o: Toolbar.cc i18n.hh ../nls/blackbox-nls.hh blackbox.hh \
- BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh \
- Clientmenu.hh Basemenu.hh Font.hh Screen.hh Color.hh Texture.hh \
- Image.hh Configmenu.hh Iconmenu.hh Netizen.hh Rootmenu.hh \
- Workspace.hh Workspacemenu.hh GCCache.hh Toolbar.hh Window.hh \
- Windowmenu.hh Slit.hh
-Util.o: Util.cc Util.hh
-Window.o: Window.cc i18n.hh ../nls/blackbox-nls.hh blackbox.hh \
- BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh Font.hh \
- Screen.hh Color.hh Texture.hh Image.hh Configmenu.hh Basemenu.hh \
- Iconmenu.hh Netizen.hh Rootmenu.hh Workspace.hh Workspacemenu.hh \
- GCCache.hh Toolbar.hh Window.hh Windowmenu.hh Slit.hh
-Windowmenu.o: Windowmenu.cc i18n.hh ../nls/blackbox-nls.hh blackbox.hh \
- BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh Screen.hh \
- Color.hh Texture.hh Image.hh Configmenu.hh Basemenu.hh Iconmenu.hh \
- Netizen.hh Rootmenu.hh Workspace.hh Workspacemenu.hh Window.hh \
- Windowmenu.hh
-Workspace.o: Workspace.cc i18n.hh ../nls/blackbox-nls.hh blackbox.hh \
- BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh \
- Clientmenu.hh Basemenu.hh Netizen.hh Screen.hh Color.hh Texture.hh \
- Image.hh Configmenu.hh Iconmenu.hh Rootmenu.hh Workspace.hh \
- Workspacemenu.hh Toolbar.hh Window.hh Windowmenu.hh
-Workspacemenu.o: Workspacemenu.cc i18n.hh ../nls/blackbox-nls.hh \
- blackbox.hh BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh \
- Screen.hh Color.hh Texture.hh Image.hh Configmenu.hh Basemenu.hh \
- Iconmenu.hh Netizen.hh Rootmenu.hh Workspace.hh Workspacemenu.hh \
- Toolbar.hh
-XAtom.o: XAtom.cc ../config.h XAtom.hh Screen.hh Color.hh Texture.hh \
- Util.hh Image.hh Timer.hh BaseDisplay.hh Configmenu.hh Basemenu.hh \
- Iconmenu.hh Netizen.hh Rootmenu.hh Workspace.hh Workspacemenu.hh \
- blackbox.hh i18n.hh ../nls/blackbox-nls.hh Configuration.hh
-blackbox.o: blackbox.cc i18n.hh ../nls/blackbox-nls.hh blackbox.hh \
- BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh Basemenu.hh \
- Clientmenu.hh GCCache.hh Color.hh Image.hh Rootmenu.hh Screen.hh \
- Texture.hh Configmenu.hh Iconmenu.hh Netizen.hh Workspace.hh \
- Workspacemenu.hh Slit.hh Toolbar.hh Window.hh Windowmenu.hh
-i18n.o: i18n.cc i18n.hh ../nls/blackbox-nls.hh
-main.o: main.cc ../version.h i18n.hh ../nls/blackbox-nls.hh \
- blackbox.hh BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh
// -*- mode: C++; indent-tabs-mode: nil; -*-
-// BaseDisplay.cc for Blackbox - an X11 Window manager
-// Copyright (c) 2001 - 2002 Sean 'Shaleh' Perry <shaleh@debian.org>
-// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the "Software"),
-// to deal in the Software without restriction, including without limitation
-// the rights to use, copy, modify, merge, publish, distribute, sublicense,
-// and/or sell copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// 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
-// DEALINGS IN THE SOFTWARE.
#ifdef HAVE_CONFIG_H
# include "../config.h"
char errtxt[128];
XGetErrorText(d, e->error_code, errtxt, 128);
- fprintf(stderr,
- i18n(BaseDisplaySet, BaseDisplayXError,
- "%s: X error: %s(%d) opcodes %d/%d\n resource 0x%lx\n"),
+ fprintf(stderr, "%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
// signal handler to allow for proper and gentle shutdown
-#ifndef HAVE_SIGACTION
-static RETSIGTYPE signalhandler(int sig) {
-#else // HAVE_SIGACTION
static void signalhandler(int sig) {
-#endif // HAVE_SIGACTION
static int re_enter = 0;
case SIGCHLD:
int status;
waitpid(-1, &status, WNOHANG | WUNTRACED);
-
-#ifndef HAVE_SIGACTION
- // 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
-
+ if (base_display->handleSignal(sig))
return;
- }
- fprintf(stderr, i18n(BaseDisplaySet, BaseDisplaySignalCaught,
- "%s: signal %d caught\n"),
+ fprintf(stderr, "%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"));
+ fprintf(stderr, "shutting down\n");
base_display->shutdown();
}
if (sig != SIGTERM && sig != SIGINT) {
- fprintf(stderr, i18n(BaseDisplaySet, BaseDisplayAborting,
- "aborting... dumping core\n"));
+ fprintf(stderr, "aborting... dumping core\n");
abort();
}
::base_display = this;
-#ifdef HAVE_SIGACTION
struct sigaction action;
action.sa_handler = signalhandler;
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"));
+ "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"));
+ "BaseDisplay::BaseDisplay: couldn't mark display connection "
+ "as close-on-exec\n");
::exit(2);
}
using std::string;
#include "blackbox.hh"
-#include "basemenu.hh"
-#include "clientmenu.hh"
#include "gccache.hh"
#include "image.hh"
-#include "rootmenu.hh"
#include "screen.hh"
-#include "slit.hh"
-#include "toolbar.hh"
#include "util.hh"
#include "window.hh"
#include "workspace.hh"
-#include "workspacemenu.hh"
#include "xatom.hh"
Blackbox *blackbox;
-Blackbox::Blackbox(char **m_argv, char *dpy_name, char *rc, char *menu)
+Blackbox::Blackbox(char **m_argv, char *dpy_name, char *rc)
: BaseDisplay(m_argv[0], dpy_name) {
if (! XSupportsLocale())
fprintf(stderr, "X server does not support locale\n");
rc_file = expandTilde(rc);
config.setFile(rc_file);
- string rcmenu;
- if (! menu) {
- //have to come up with something better than this
- config.load();
- if (! config.getValue("session.menuFile", rcmenu))
- rcmenu = "~/.openbox/menu";
- } else {
- rcmenu = menu;
- }
- menu_file = expandTilde(rcmenu.c_str());
-
no_focus = False;
resource.auto_raise_delay.tv_sec = resource.auto_raise_delay.tv_usec = 0;
if (screenList.empty()) {
fprintf(stderr,
- i18n(blackboxSet, blackboxNoManagableScreens,
- "Blackbox::Blackbox: no managable screens found, aborting.\n"));
+ "Blackbox::Blackbox: no managable screens found, aborting.\n");
::exit(3);
}
XSynchronize(getXDisplay(), False);
XSync(getXDisplay(), False);
- reconfigure_wait = reread_menu_wait = False;
+ reconfigure_wait = False;
timer = new BTimer(this, this);
timer->setTimeout(0l);
Blackbox::~Blackbox(void) {
std::for_each(screenList.begin(), screenList.end(), PointerAssassin());
- std::for_each(menuTimestamps.begin(), menuTimestamps.end(),
- PointerAssassin());
-
delete xatom;
delete timer;
last_time = e->xbutton.time;
BlackboxWindow *win = (BlackboxWindow *) 0;
- Basemenu *menu = (Basemenu *) 0;
- Slit *slit = (Slit *) 0;
- Toolbar *tbar = (Toolbar *) 0;
BScreen *scrn = (BScreen *) 0;
if ((win = searchWindow(e->xbutton.window))) {
/* XXX: is this sane on low colour desktops? */
if (e->xbutton.button == 1)
win->installColormap(True);
- } else if ((menu = searchMenu(e->xbutton.window))) {
- menu->buttonPressEvent(&e->xbutton);
- } else if ((slit = searchSlit(e->xbutton.window))) {
- slit->buttonPressEvent(&e->xbutton);
- } else if ((tbar = searchToolbar(e->xbutton.window))) {
- tbar->buttonPressEvent(&e->xbutton);
} else if ((scrn = searchScreen(e->xbutton.window))) {
scrn->buttonPressEvent(&e->xbutton);
if (active_screen != scrn) {
last_time = e->xbutton.time;
BlackboxWindow *win = (BlackboxWindow *) 0;
- Basemenu *menu = (Basemenu *) 0;
- Toolbar *tbar = (Toolbar *) 0;
if ((win = searchWindow(e->xbutton.window)))
win->buttonReleaseEvent(&e->xbutton);
- else if ((menu = searchMenu(e->xbutton.window)))
- menu->buttonReleaseEvent(&e->xbutton);
- else if ((tbar = searchToolbar(e->xbutton.window)))
- tbar->buttonReleaseEvent(&e->xbutton);
break;
}
case ConfigureRequest: {
BlackboxWindow *win = (BlackboxWindow *) 0;
- Slit *slit = (Slit *) 0;
if ((win = searchWindow(e->xconfigurerequest.window))) {
win->configureRequestEvent(&e->xconfigurerequest);
- } else if ((slit = searchSlit(e->xconfigurerequest.window))) {
- slit->configureRequestEvent(&e->xconfigurerequest);
} else {
if (validateWindow(e->xconfigurerequest.window)) {
XWindowChanges xwc;
case UnmapNotify: {
BlackboxWindow *win = (BlackboxWindow *) 0;
- Slit *slit = (Slit *) 0;
BScreen *screen = (BScreen *) 0;
if ((win = searchWindow(e->xunmap.window))) {
win->unmapNotifyEvent(&e->xunmap);
- } else if ((slit = searchSlit(e->xunmap.window))) {
- slit->unmapNotifyEvent(&e->xunmap);
} else if ((screen = searchSystrayWindow(e->xunmap.window))) {
screen->removeSystrayWindow(e->xunmap.window);
}
case DestroyNotify: {
BlackboxWindow *win = (BlackboxWindow *) 0;
- Slit *slit = (Slit *) 0;
BScreen *screen = (BScreen *) 0;
BWindowGroup *group = (BWindowGroup *) 0;
if ((win = searchWindow(e->xdestroywindow.window))) {
win->destroyNotifyEvent(&e->xdestroywindow);
- } else if ((slit = searchSlit(e->xdestroywindow.window))) {
- slit->removeClient(e->xdestroywindow.window, False);
} else if ((group = searchGroup(e->xdestroywindow.window))) {
delete group;
} else if ((screen = searchSystrayWindow(e->xunmap.window))) {
to an already unmapped window.
*/
BlackboxWindow *win = searchWindow(e->xreparent.window);
- if (win) {
+ if (win)
win->reparentNotifyEvent(&e->xreparent);
- } else {
- Slit *slit = searchSlit(e->xreparent.window);
- if (slit && slit->getWindowID() != e->xreparent.parent)
- slit->removeClient(e->xreparent.window, True);
- }
break;
}
last_time = e->xmotion.time;
BlackboxWindow *win = (BlackboxWindow *) 0;
- Basemenu *menu = (Basemenu *) 0;
if ((win = searchWindow(e->xmotion.window)))
win->motionNotifyEvent(&e->xmotion);
- else if ((menu = searchMenu(e->xmotion.window)))
- menu->motionNotifyEvent(&e->xmotion);
break;
}
BScreen *screen = (BScreen *) 0;
BlackboxWindow *win = (BlackboxWindow *) 0;
- Basemenu *menu = (Basemenu *) 0;
- Toolbar *tbar = (Toolbar *) 0;
- Slit *slit = (Slit *) 0;
if (e->xcrossing.mode == NotifyGrab) break;
} else if ((win = searchWindow(e->xcrossing.window))) {
if (! no_focus)
win->enterNotifyEvent(&e->xcrossing);
- } else if ((menu = searchMenu(e->xcrossing.window))) {
- menu->enterNotifyEvent(&e->xcrossing);
- } else if ((tbar = searchToolbar(e->xcrossing.window))) {
- tbar->enterNotifyEvent(&e->xcrossing);
- } else if ((slit = searchSlit(e->xcrossing.window))) {
- slit->enterNotifyEvent(&e->xcrossing);
}
break;
}
last_time = e->xcrossing.time;
BlackboxWindow *win = (BlackboxWindow *) 0;
- Basemenu *menu = (Basemenu *) 0;
- Toolbar *tbar = (Toolbar *) 0;
- Slit *slit = (Slit *) 0;
- if ((menu = searchMenu(e->xcrossing.window)))
- menu->leaveNotifyEvent(&e->xcrossing);
- else if ((win = searchWindow(e->xcrossing.window)))
+ if ((win = searchWindow(e->xcrossing.window)))
win->leaveNotifyEvent(&e->xcrossing);
- else if ((tbar = searchToolbar(e->xcrossing.window)))
- tbar->leaveNotifyEvent(&e->xcrossing);
- else if ((slit = searchSlit(e->xcrossing.window)))
- slit->leaveNotifyEvent(&e->xcrossing);
break;
}
e->xexpose.height = ey2 - ey1 + 1;
BlackboxWindow *win = (BlackboxWindow *) 0;
- Basemenu *menu = (Basemenu *) 0;
- Toolbar *tbar = (Toolbar *) 0;
if ((win = searchWindow(e->xexpose.window)))
win->exposeEvent(&e->xexpose);
- else if ((menu = searchMenu(e->xexpose.window)))
- menu->exposeEvent(&e->xexpose);
- else if ((tbar = searchToolbar(e->xexpose.window)))
- tbar->exposeEvent(&e->xexpose);
break;
}
case KeyPress: {
- Toolbar *tbar = searchToolbar(e->xkey.window);
-
- if (tbar && tbar->isEditing())
- tbar->keyPressEvent(&e->xkey);
-
break;
}
}
}
}
- } else if (e->xclient.message_type ==
- xatom->getAtom(XAtom::openbox_show_root_menu) ||
- e->xclient.message_type ==
- xatom->getAtom(XAtom::openbox_show_workspace_menu)) {
- // find the screen the mouse is on
- int x, y;
- ScreenList::iterator it, end = screenList.end();
- for (it = screenList.begin(); it != end; ++it) {
- Window w;
- int i;
- unsigned int m;
- if (XQueryPointer(getXDisplay(), (*it)->getRootWindow(),
- &w, &w, &x, &y, &i, &i, &m))
- break;
- }
- if (it != end) {
- if (e->xclient.message_type ==
- xatom->getAtom(XAtom::openbox_show_root_menu))
- (*it)->showRootMenu(x, y);
- else
- (*it)->showWorkspaceMenu(x, y);
- }
}
}
break;
case SIGUSR2:
- rereadMenu();
break;
case SIGPIPE:
}
-Basemenu *Blackbox::searchMenu(Window window) {
- MenuLookup::iterator it = menuSearchList.find(window);
- if (it != menuSearchList.end())
- return it->second;
-
- return (Basemenu*) 0;
-}
-
-
-Toolbar *Blackbox::searchToolbar(Window window) {
- ToolbarLookup::iterator it = toolbarSearchList.find(window);
- if (it != toolbarSearchList.end())
- return it->second;
-
- return (Toolbar*) 0;
-}
-
-
-Slit *Blackbox::searchSlit(Window window) {
- SlitLookup::iterator it = slitSearchList.find(window);
- if (it != slitSearchList.end())
- return it->second;
-
- return (Slit*) 0;
-}
-
-
void Blackbox::saveSystrayWindowSearch(Window window, BScreen *screen) {
systraySearchList.insert(WindowScreenLookupPair(window, screen));
}
}
-void Blackbox::saveMenuSearch(Window window, Basemenu *data) {
- menuSearchList.insert(MenuLookupPair(window, data));
-}
-
-
-void Blackbox::saveToolbarSearch(Window window, Toolbar *data) {
- toolbarSearchList.insert(ToolbarLookupPair(window, data));
-}
-
-
-void Blackbox::saveSlitSearch(Window window, Slit *data) {
- slitSearchList.insert(SlitLookupPair(window, data));
-}
-
-
void Blackbox::removeSystrayWindowSearch(Window window) {
systraySearchList.erase(window);
}
}
-void Blackbox::removeMenuSearch(Window window) {
- menuSearchList.erase(window);
-}
-
-
-void Blackbox::removeToolbarSearch(Window window) {
- toolbarSearchList.erase(window);
-}
-
-
-void Blackbox::removeSlitSearch(Window window) {
- slitSearchList.erase(window);
-}
-
-
void Blackbox::restart(const char *prog) {
shutdown();
void Blackbox::real_reconfigure(void) {
load_rc();
- std::for_each(menuTimestamps.begin(), menuTimestamps.end(),
- PointerAssassin());
- menuTimestamps.clear();
-
gcCache()->purge();
std::for_each(screenList.begin(), screenList.end(),
}
-void Blackbox::checkMenu(void) {
- bool reread = False;
- MenuTimestampList::iterator it = menuTimestamps.begin();
- for(; it != menuTimestamps.end(); ++it) {
- MenuTimestamp *tmp = *it;
- struct stat buf;
-
- if (! stat(tmp->filename.c_str(), &buf)) {
- if (tmp->timestamp != buf.st_ctime)
- reread = True;
- } else {
- reread = True;
- }
- }
-
- if (reread) rereadMenu();
-}
-
-
-void Blackbox::rereadMenu(void) {
- reread_menu_wait = True;
-
- if (! timer->isTiming()) timer->start();
-}
-
-
-void Blackbox::real_rereadMenu(void) {
- std::for_each(menuTimestamps.begin(), menuTimestamps.end(),
- PointerAssassin());
- menuTimestamps.clear();
-
- std::for_each(screenList.begin(), screenList.end(),
- std::mem_fun(&BScreen::rereadMenu));
-}
-
-
void Blackbox::saveStyleFilename(const string& filename) {
assert(! filename.empty());
resource.style_file = filename;
}
-void Blackbox::addMenuTimestamp(const string& filename) {
- assert(! filename.empty());
- bool found = False;
-
- MenuTimestampList::iterator it = menuTimestamps.begin();
- for (; it != menuTimestamps.end() && ! found; ++it) {
- if ((*it)->filename == filename) found = True;
- }
- if (! found) {
- struct stat buf;
-
- if (! stat(filename.c_str(), &buf)) {
- MenuTimestamp *ts = new MenuTimestamp;
-
- ts->filename = filename;
- ts->timestamp = buf.st_ctime;
-
- menuTimestamps.push_back(ts);
- }
- }
-}
-
-
void Blackbox::timeout(void) {
if (reconfigure_wait)
real_reconfigure();
- if (reread_menu_wait)
- real_rereadMenu();
-
- reconfigure_wait = reread_menu_wait = False;
+ reconfigure_wait = False;
}
}
if (active_screen && active_screen->isScreenManaged()) {
- active_screen->getToolbar()->redrawWindowLabel(True);
active_screen->updateNetizenWindowFocus();
}
if (old_screen && old_screen != active_screen) {
- old_screen->getToolbar()->redrawWindowLabel(True);
old_screen->updateNetizenWindowFocus();
}
}
class Blackbox;
class BlackboxWindow;
class BWindowGroup;
-class Basemenu;
-class Toolbar;
-class Slit;
-
-extern I18n i18n;
class Blackbox : public BaseDisplay, public TimeoutHandler {
private:
};
BCursor cursor;
- struct MenuTimestamp {
- std::string filename;
- time_t timestamp;
- };
-
struct BResource {
Time double_click_interval;
typedef GroupLookup::value_type GroupLookupPair;
GroupLookup groupSearchList;
- typedef std::map<Window, Basemenu*> MenuLookup;
- typedef MenuLookup::value_type MenuLookupPair;
- MenuLookup menuSearchList;
-
- typedef std::map<Window, Toolbar*> ToolbarLookup;
- typedef ToolbarLookup::value_type ToolbarLookupPair;
- ToolbarLookup toolbarSearchList;
-
- typedef std::map<Window, Slit*> SlitLookup;
- typedef SlitLookup::value_type SlitLookupPair;
- SlitLookup slitSearchList;
-
- typedef std::list<MenuTimestamp*> MenuTimestampList;
- MenuTimestampList menuTimestamps;
-
typedef std::list<BScreen*> ScreenList;
ScreenList screenList;
Configuration config;
XAtom *xatom;
- bool no_focus, reconfigure_wait, reread_menu_wait;
+ bool no_focus, reconfigure_wait;
Time last_time;
char **argv;
- std::string menu_file, rc_file;
+ std::string rc_file;
Blackbox(const Blackbox&);
Blackbox& operator=(const Blackbox&);
void load_rc(void);
void save_rc(void);
- void real_rereadMenu(void);
void real_reconfigure(void);
virtual void process_event(XEvent *);
public:
- Blackbox(char **m_argv, char *dpy_name = 0, char *rc = 0, char *menu = 0);
+ Blackbox(char **m_argv, char *dpy_name = 0, char *rc = 0);
virtual ~Blackbox(void);
- Basemenu *searchMenu(Window window);
BWindowGroup *searchGroup(Window window);
BScreen *searchSystrayWindow(Window window);
BlackboxWindow *searchWindow(Window window);
BScreen *searchScreen(Window window);
- Toolbar *searchToolbar(Window);
- Slit *searchSlit(Window);
#ifdef XINERAMA
inline bool doXineramaPlacement(void) const
void saveXineramaSnapping(bool x);
#endif // XINERAMA
- void saveMenuSearch(Window window, Basemenu *data);
void saveSystrayWindowSearch(Window window, BScreen *screen);
void saveWindowSearch(Window window, BlackboxWindow *data);
void saveGroupSearch(Window window, BWindowGroup *data);
- void saveToolbarSearch(Window window, Toolbar *data);
- void saveSlitSearch(Window window, Slit *data);
- void removeMenuSearch(Window window);
void removeSystrayWindowSearch(Window window);
void removeWindowSearch(Window window);
void removeGroupSearch(Window window);
- void removeToolbarSearch(Window window);
- void removeSlitSearch(Window window);
inline XAtom *getXAtom(void) { return xatom; }
inline const char *getStyleFilename(void) const
{ return resource.style_file.c_str(); }
- inline const char *getMenuFilename(void) const
- { return menu_file.c_str(); }
inline int getColorsPerChannel(void) const
{ return resource.colors_per_channel; }
void setChangingWindow(BlackboxWindow *win);
void shutdown(void);
void saveStyleFilename(const std::string& filename);
- void addMenuTimestamp(const std::string& filename);
void restart(const char *prog = 0);
void reconfigure(void);
- void rereadMenu(void);
- void checkMenu(void);
bool validateWindow(Window window);
virtual void timeout(void);
-#ifndef HAVE_STRFTIME
enum { B_AmericanDate = 1, B_EuropeanDate };
-#endif // HAVE_STRFTIME
};
string BFont::_fallback_font = "fixed";
-#ifdef XFT
BFont::BFont(Display *d, BScreen *screen, const string &family, int size,
bool bold, bool italic, bool shadow, unsigned char offset,
unsigned char tint, bool antialias) :
_shadow(shadow),
_offset(offset),
_tint(tint),
- _xftfont(0),
- _font(0),
- _fontset(0),
- _fontset_extents(0) {
+ _xftfont(0) {
_valid = False;
_xftfont = XftFontOpen(_display, _screen->getScreenNumber(),
if (! _xftfont)
return; // failure
- _font = XLoadQueryFont(_display, buildXlfd().c_str());
- if (! _font)
- return; // failure
-
_valid = True;
}
-#endif
-
-
-BFont::BFont(Display *d, BScreen *screen, const string &xlfd) :
- _display(d),
- _screen(screen),
-#ifdef XFT
- _antialias(False),
- _shadow(False),
- _xftfont(0),
-#endif // XFT
- _font(0),
- _fontset(0),
- _fontset_extents(0) {
- string int_xlfd;
- if (xlfd.empty())
- int_xlfd = _fallback_font;
- else
- int_xlfd = xlfd;
-
- if ((_valid = createXFont(int_xlfd)))
- return; // success
-
- if (int_xlfd != _fallback_font) {
- // try the fallback
- cerr << "BFont::BFont(): couldn't load font '" << _family << "'" << endl <<
- "Falling back to default '" << _fallback_font << "'" << endl;
-
- if ((_valid = createXFont(_fallback_font)))
- return; // success
- }
-
- cerr << "BFont::BFont(): couldn't load font '" << _family << "'" << endl <<
- "Giving up!" << endl;
- return; // failure
-}
-
-
-bool BFont::createXFont(const std::string &xlfd) {
- /*
- Even though this is only used for font sets (multibyte), it is still parsed
- out so that the bold/italic/etc information is still available from the
- class when using non-multibyte.
-
- This is where _simplename, _bold, _italic, and _size are initialized, since
- they are not initialized in the constructor. This needs to occur before
- calling any Xlfd-building functions.
- */
- if (! parseXlfd(xlfd))
- return False;
-
- if (i18n.multibyte()) {
- char **missing, *def = "-";
- int nmissing;
-
- _fontset = XCreateFontSet(_display, buildMultibyteXlfd().c_str(),
- &missing, &nmissing, &def);
- if (nmissing) XFreeStringList(missing);
- if (_fontset)
- _fontset_extents = XExtentsOfFontSet(_fontset);
- else
- return False;
-
- assert(_fontset_extents);
- }
-
- _font = XLoadQueryFont(_display, xlfd.c_str());
- if (! _font)
- return False;
- return True;
-}
BFont::~BFont(void) {
-#ifdef XFT
if (_xftfont)
XftFontClose(_display, _xftfont);
-#endif // XFT
-
- if (i18n.multibyte() && _fontset)
- XFreeFontSet(_display, _fontset);
- if (_font)
- XFreeFont(_display, _font);
-}
-
-
-/*
- * Takes _family, _size, _bold, _italic, etc and builds them into a full XLFD.
- */
-string BFont::buildXlfd(void) const {
- if (_simplename)
- return _family;
-
- string weight = _bold ? "bold" : "medium";
- string slant = _italic ? "i" : "r";
- string sizestr= _size ? itostring(_size * 10) : "*";
-
- return "-*-" + _family + "-" + weight + "-" + slant + "-*-*-*-" + sizestr +
- "-*-*-*-*-*-*";
-}
-
-
-/*
- * Takes _family, _size, _bold, _italic, etc and builds them into a full XLFD.
- */
-string BFont::buildMultibyteXlfd(void) const {
- string weight = _bold ? "bold" : "medium";
- string slant = _italic ? "i" : "r";
- string sizestr= _size ? itostring(_size) : "*";
-
- return _family + ','
- + "-*-*-" + weight + "-" + slant + "-*-*-*-" + sizestr +
- "-*-*-*-*-*-*" + ','
- + "-*-*-*-*-*-*-*-" + sizestr + "-*-*-*-*-*-*" + ',' +
- + "*";
-}
-
-
-/*
- * Takes a full X font name and parses it out so we know if we're bold, our
- * size, etc.
- */
-bool BFont::parseXlfd(const string &xlfd) {
- if (xlfd.empty() || xlfd[0] != '-') {
- _family = xlfd;
- _simplename = True;
- _bold = False;
- _italic = False;
- _size = 0;
- } else {
- _simplename = False;
- string weight,
- slant,
- sizestr;
- int i = 0;
-
- string::const_iterator it = xlfd.begin(), end = xlfd.end();
- while(1) {
- string::const_iterator tmp = it; // current string.begin()
- it = std::find(tmp, end, '-'); // look for comma between tmp and end
- if (i == 2) _family = string(tmp, it); // s[tmp:it]
- if (i == 3) weight = string(tmp, it);
- if (i == 4) slant = string(tmp, it);
- if (i == 7 && string(tmp, it) != "*") sizestr = string(tmp, it);
- if (sizestr.empty() &&
- i == 8 && string(tmp, it) != "*") sizestr = string(tmp, it);
- if (it == end || i >= 8)
- break;
- ++it;
- ++i;
- }
- if (i < 3) // no name even! can't parse that
- return False;
- _bold = weight == "bold" || weight == "demibold";
- _italic = slant == "i" || slant == "o";
- _size = atoi(sizestr.c_str()) / 10;
- }
-
- // min/max size restrictions for sanity, but 0 is the font's "default size"
- if (_size && _size < 3)
- _size = 3;
- else if (_size > 97)
- _size = 97;
-
- return True;
}
const string &string) const {
assert(_valid);
-#ifdef XFT
- if (_xftfont) {
- XftDraw *draw = XftDrawCreate(_display, d, _screen->getVisual(),
- _screen->getColormap());
- assert(draw);
+ XftDraw *draw = XftDrawCreate(_display, d, _screen->getVisual(),
+ _screen->getColormap());
+ assert(draw);
- if (_shadow) {
- XftColor c;
- c.color.red = 0;
- c.color.green = 0;
- c.color.blue = 0;
- c.color.alpha = _tint | _tint << 8; // transparent shadow
- c.pixel = BlackPixel(_display, _screen->getScreenNumber());
-
-#ifdef XFT_UTF8
- XftDrawStringUtf8(
-#else
- XftDrawString8(
-#endif
- draw, &c, _xftfont, x + _offset,
- _xftfont->ascent + y + _offset, (XftChar8 *) string.c_str(),
- string.size());
- }
-
+ if (_shadow) {
XftColor c;
- c.color.red = color.red() | color.red() << 8;
- c.color.green = color.green() | color.green() << 8;
- c.color.blue = color.blue() | color.blue() << 8;
- c.pixel = color.pixel();
- c.color.alpha = 0xff | 0xff << 8; // no transparency in BColor yet
-
-#ifdef XFT_UTF8
- XftDrawStringUtf8(
-#else
- XftDrawString8(
-#endif
- draw, &c, _xftfont, x, _xftfont->ascent + y,
- (XftChar8 *) string.c_str(), string.size());
-
- XftDrawDestroy(draw);
- return;
+ c.color.red = 0;
+ c.color.green = 0;
+ c.color.blue = 0;
+ c.color.alpha = _tint | _tint << 8; // transparent shadow
+ c.pixel = BlackPixel(_display, _screen->getScreenNumber());
+
+ XftDrawStringUtf8(draw, &c, _xftfont, x + _offset,
+ _xftfont->ascent + y + _offset,
+ (XftChar8 *) string.c_str(),
+ string.size());
}
-#endif // XFT
-
- BPen pen(color, _font);
-
- if (i18n.multibyte())
- XmbDrawString(_display, d, _fontset, pen.gc(),
- x, y - _fontset_extents->max_ink_extent.y,
- string.c_str(), string.size());
- else
- XDrawString(_display, d, pen.gc(),
- x, _font->ascent + y,
- string.c_str(), string.size());
+
+ XftColor c;
+ c.color.red = color.red() | color.red() << 8;
+ c.color.green = color.green() | color.green() << 8;
+ c.color.blue = color.blue() | color.blue() << 8;
+ c.pixel = color.pixel();
+ c.color.alpha = 0xff | 0xff << 8; // no transparency in BColor yet
+
+ XftDrawStringUtf8(draw, &c, _xftfont, x, _xftfont->ascent + y,
+ (XftChar8 *) string.c_str(), string.size());
+
+ XftDrawDestroy(draw);
+ return;
}
unsigned int BFont::measureString(const string &string) const {
assert(_valid);
-#ifdef XFT
- if (_xftfont) {
- XGlyphInfo info;
-
-#ifdef XFT_UTF8
- XftTextExtentsUtf8(
-#else
- XftTextExtents8(
-#endif
- _display, _xftfont, (XftChar8 *) string.c_str(),
- string.size(), &info);
+ XGlyphInfo info;
- return info.xOff + (_shadow ? _offset : 0);
- }
-#endif // XFT
+ XftTextExtentsUtf8(_display, _xftfont, (XftChar8 *) string.c_str(),
+ string.size(), &info);
- if (i18n.multibyte()) {
- XRectangle ink, logical;
- XmbTextExtents(_fontset, string.c_str(), string.size(), &ink, &logical);
- return logical.width;
- } else {
- return XTextWidth(_font, string.c_str(), string.size());
- }
+ return info.xOff + (_shadow ? _offset : 0);
}
unsigned int BFont::height(void) const {
assert(_valid);
-#ifdef XFT
- if (_xftfont)
- return _xftfont->height + (_shadow ? _offset : 0);
-#endif // XFT
-
- if (i18n.multibyte())
- return _fontset_extents->max_ink_extent.height;
- else
- return _font->ascent + _font->descent;
+ return _xftfont->height + (_shadow ? _offset : 0);
}
unsigned int BFont::maxCharWidth(void) const {
assert(_valid);
-#ifdef XFT
- if (_xftfont)
- return _xftfont->max_advance_width;
-#endif // XFT
-
- if (i18n.multibyte())
- return _fontset_extents->max_logical_extent.width;
- else
- return _font->max_bounds.rbearing - _font->min_bounds.lbearing;
+ return _xftfont->max_advance_width;
}
extern "C" {
#include <X11/Xlib.h>
-#ifdef XFT
-# include <X11/Xft/Xft.h>
-#endif
+#include <X11/Xft/Xft.h>
}
#include <assert.h>
bool _bold;
bool _italic;
-#ifdef XFT
bool _antialias;
bool _shadow;
unsigned char _offset;
XftFont *_xftfont;
bool createXftFont(void);
-#endif
-
- // standard
- XFontStruct *_font;
- // multibyte
- XFontSet _fontset;
- XFontSetExtents *_fontset_extents;
-
- std::string buildXlfd(void) const;
- std::string buildMultibyteXlfd(void) const;
-
- bool createXFont(const std::string &xlfd);
- bool parseXlfd(const std::string &xlfd);
bool _valid;
public:
-#ifdef XFT
// loads an Xft font
BFont(Display *d, BScreen *screen, const std::string &family, int size,
bool bold, bool italic, bool shadow, unsigned char offset,
unsigned char tint, bool antialias = True);
-#endif
- // loads a standard X font
- BFont(Display *d, BScreen *screen, const std::string &xlfd);
virtual ~BFont(void);
inline bool valid(void) const { return _valid; }
control->getDrawable(), width,
height, control->getDepth());
if (pixmap == None) {
- fprintf(stderr, i18n(ImageSet, ImageErrorCreatingSolidPixmap,
- "BImage::render_solid: error creating pixmap\n"));
+ fprintf(stderr, "BImage::render_solid: error creating pixmap\n");
return None;
}
width, height, 32, 0);
if (! image) {
- fprintf(stderr, i18n(ImageSet, ImageErrorCreatingXImage,
- "BImage::renderXImage: error creating XImage\n"));
+ fprintf(stderr, "BImage::renderXImage: error creating XImage\n");
return (XImage *) 0;
}
}
if (unsupported) {
- fprintf(stderr, i18n(ImageSet, ImageUnsupVisual,
- "BImage::renderXImage: unsupported visual\n"));
+ fprintf(stderr, "BImage::renderXImage: unsupported visual\n");
delete [] d;
XDestroyImage(image);
return (XImage *) 0;
control->getDrawable(), width, height, control->getDepth());
if (pixmap == None) {
- fprintf(stderr, i18n(ImageSet, ImageErrorCreatingPixmap,
- "BImage::renderPixmap: error creating pixmap\n"));
+ fprintf(stderr, "BImage::renderPixmap: error creating pixmap\n");
return None;
}
bool dither;
BaseDisplay *basedisplay;
const ScreenInfo *screeninfo;
-#ifdef TIMEDCACHE
BTimer *timer;
-#endif // TIMEDCACHE
Colormap colormap;
setColorsPerChannel(_cpc);
cache_max = cmax;
-#ifdef TIMEDCACHE
if (cache_timeout) {
timer = new BTimer(basedisplay, this);
timer->setTimeout(cache_timeout);
} else {
timer = (BTimer *) 0;
}
-#endif // TIMEDCACHE
colors = (XColor *) 0;
ncolors = 0;
if (colors_per_channel < 2 || ncolors > (1 << screen_depth)) {
fprintf(stderr,
- i18n(ImageSet, ImageInvalidColormapSize,
- "BImageControl::BImageControl: invalid colormap size %d "
- "(%d/%d/%d) - reducing"),
+ "BImageControl::BImageControl: invalid colormap size %d "
+ "(%d/%d/%d) - reducing",
ncolors, colors_per_channel, colors_per_channel,
colors_per_channel);
colors = new XColor[ncolors];
if (! colors) {
- fprintf(stderr, i18n(ImageSet, ImageErrorAllocatingColormap,
- "BImageControl::BImageControl: error allocating "
- "colormap\n"));
+ fprintf(stderr, "BImageControl::BImageControl: error allocating "
+ "colormap\n");
exit(1);
}
for (i = 0; i < ncolors; i++) {
if (! XAllocColor(basedisplay->getXDisplay(), colormap, &colors[i])) {
- fprintf(stderr, i18n(ImageSet, ImageColorAllocFail,
- "couldn't alloc color %i %i %i\n"),
+ fprintf(stderr, "couldn't alloc color %i %i %i\n",
colors[i].red, colors[i].green, colors[i].blue);
colors[i].flags = 0;
} else {
if (colors_per_channel < 2 || ncolors > (1 << screen_depth)) {
fprintf(stderr,
- i18n(ImageSet, ImageInvalidColormapSize,
- "BImageControl::BImageControl: invalid colormap size %d "
- "(%d/%d/%d) - reducing"),
+ "BImageControl::BImageControl: invalid colormap size %d "
+ "(%d/%d/%d) - reducing",
ncolors, colors_per_channel, colors_per_channel,
colors_per_channel);
colors = new XColor[ncolors];
if (! colors) {
fprintf(stderr,
- i18n(ImageSet, ImageErrorAllocatingColormap,
- "BImageControl::BImageControl: error allocating colormap\n"));
+ "BImageControl::BImageControl: error allocating colormap\n");
exit(1);
}
if (! XAllocColor(basedisplay->getXDisplay(), colormap,
&colors[i])) {
- fprintf(stderr, i18n(ImageSet, ImageColorAllocFail,
- "couldn't alloc color %i %i %i\n"),
+ fprintf(stderr, "couldn't alloc color %i %i %i\n",
colors[i].red, colors[i].green, colors[i].blue);
colors[i].flags = 0;
} else {
}
default:
- fprintf(stderr,
- i18n(ImageSet, ImageUnsupVisual,
- "BImageControl::BImageControl: unsupported visual %d\n"),
+ fprintf(stderr, "BImageControl::BImageControl: unsupported visual %d\n",
getVisual()->c_class);
exit(1);
}
if (! cache.empty()) {
//#ifdef DEBUG
- fprintf(stderr, i18n(ImageSet, ImagePixmapRelease,
- "BImageContol::~BImageControl: pixmap cache - "
- "releasing %d pixmaps\n"), cache.size());
+ fprintf(stderr, "BImageContol::~BImageControl: pixmap cache - "
+ "releasing %d pixmaps\n", cache.size());
//#endif
CacheContainer::iterator it = cache.begin();
const CacheContainer::iterator end = cache.end();
for (; it != end; ++it)
XFreePixmap(basedisplay->getXDisplay(), it->pixmap);
}
-#ifdef TIMEDCACHE
if (timer) {
timer->stop();
delete timer;
}
-#endif // TIMEDCACHE
}
if (cache.size() > cache_max) {
#ifdef DEBUG
- fprintf(stderr, i18n(ImageSet, ImagePixmapCacheLarge,
- "BImageControl::renderImage: cache is large, "
- "forcing cleanout\n"));
+ fprintf(stderr, "BImageControl::renderImage: cache is large, "
+ "forcing cleanout\n");
#endif // DEBUG
timeout();
tmp.count--;
}
-#ifdef TIMEDCACHE
if (! timer)
-#endif // TIMEDCACHE
timeout();
}
#include "blackbox.hh"
-I18n i18n; // initialized in main
-
static void showHelp(int exitval) {
// print program usage and command line options
- printf(i18n(mainSet, mainUsage,
- "Openbox %s : (c) 2002 - 2002 Ben Jansens\n"
- " 2001 - 2002 Sean 'Shaleh' Perry\n"
- " 1997 - 2000, 2002 Brad Hughes\n\n"
- " -display <string>\t\tuse display connection.\n"
- " -rc <string>\t\t\tuse alternate resource file.\n"
- " -menu <string>\t\tuse alternate menu file.\n"
- " -version\t\t\tdisplay version and exit.\n"
- " -help\t\t\t\tdisplay this help text and exit.\n\n"),
+ printf("Openbox %s : (c) 2002 - 2002 Ben Jansens\n"
+ " -display <string>\t\tuse display connection.\n"
+ " -rc <string>\t\t\tuse alternate resource file.\n"
+ " -menu <string>\t\tuse alternate menu file.\n"
+ " -version\t\t\tdisplay version and exit.\n"
+ " -help\t\t\t\tdisplay this help text and exit.\n\n",
OPENBOX_VERSION);
// some people have requested that we print out compile options
// as well
- printf(i18n(mainSet, mainCompileOptions,
- "Compile time options:\n"
- " Debugging:\t\t\t%s\n"
- " Shape:\t\t\t%s\n"
- " Xft:\t\t\t\t%s\n"
- " Xinerama:\t\t\t%s\n"
- " 8bpp Ordered Dithering:\t%s\n\n"),
+ printf("Compile time options:\n"
+ " Debugging:\t\t\t%s\n"
+ " Shape:\t\t\t%s\n"
+ " Xft:\t\t\t\t%s\n"
+ " Xinerama:\t\t\t%s\n"
+ " 8bpp Ordered Dithering:\t%s\n\n",
#ifdef DEBUG
- i18n(CommonSet, CommonYes, "yes"),
+ "yes",
#else // !DEBUG
- i18n(CommonSet, CommonNo, "no"),
+ "no",
#endif // DEBUG
#ifdef SHAPE
- i18n(CommonSet, CommonYes, "yes"),
+ "yes",
#else // !SHAPE
- i18n(CommonSet, CommonNo, "no"),
+ "no",
#endif // SHAPE
#ifdef XFT
- i18n(CommonSet, CommonYes, "yes"),
+ "yes",
#else // !XFT
- i18n(CommonSet, CommonNo, "no"),
+ "no",
#endif // XFT
#ifdef XINERAMA
- i18n(CommonSet, CommonYes, "yes"),
+ "yes",
#else // !XINERAMA
- i18n(CommonSet, CommonNo, "no"),
+ "no",
#endif // XINERAMA
#ifdef ORDEREDPSEUDO
- i18n(CommonSet, CommonYes, "yes")
+ "yes"
#else // !ORDEREDPSEUDO
- i18n(CommonSet, CommonNo, "no")
+ "no"
#endif // ORDEREDPSEUDO
);
char *rc_file = (char *) 0;
char *menu_file = (char *) 0;
- i18n.openCatalog("openbox.cat");
-
for (int i = 1; i < argc; ++i) {
if (! strcmp(argv[i], "-rc")) {
// look for alternative rc file to use
if ((++i) >= argc) {
- fprintf(stderr,
- i18n(mainSet, mainRCRequiresArg,
- "error: '-rc' requires and argument\n"));
+ fprintf(stderr, "error: '-rc' requires and argument\n");
::exit(1);
}
// look for alternative menu file to use
if ((++i) >= argc) {
- fprintf(stderr,
- i18n(mainSet, mainMENURequiresArg,
- "error: '-menu' requires and argument\n"));
+ fprintf(stderr, "error: '-menu' requires and argument\n");
::exit(1);
}
// set by the environment variable DISPLAY
if ((++i) >= argc) {
- fprintf(stderr,
- i18n(mainSet, mainDISPLAYRequiresArg,
- "error: '-display' requires an argument\n"));
+ fprintf(stderr, "error: '-display' requires an argument\n");
::exit(1);
}
dtmp += session_display;
if (putenv(const_cast<char*>(dtmp.c_str()))) {
- fprintf(stderr, i18n(mainSet, mainWarnDisplaySet,
- "warning: couldn't set environment variable 'DISPLAY'\n"));
+ fprintf(stderr,
+ "warning: couldn't set environment variable 'DISPLAY'\n");
perror("putenv()");
}
} else if (! strcmp(argv[i], "-version")) {
// print current version string
- printf("Openbox %s : (c) 2002 - 2002 Ben Jansens\n"
- " 2001 - 2002 Sean 'Shaleh' Perry\n"
- " 1997 - 2000, 2002 Brad Hughes\n\n",
+ printf("Openbox %s : (c) 2002 - 2002 Ben Jansens\n",
OPENBOX_VERSION);
::exit(0);
_chdir2(getenv("X11ROOT"));
#endif // __EMX__
- Blackbox blackbox(argv, session_display, rc_file, menu_file);
+ Blackbox blackbox(argv, session_display, rc_file);
blackbox.eventLoop();
return(0);
#include <string>
using std::string;
-#include "i18n.hh"
#include "blackbox.hh"
-#include "clientmenu.hh"
#include "font.hh"
#include "gccache.hh"
-#include "iconmenu.hh"
#include "image.hh"
#include "screen.hh"
-#include "slit.hh"
-#include "rootmenu.hh"
-#include "toolbar.hh"
#include "util.hh"
#include "window.hh"
#include "workspace.hh"
-#include "workspacemenu.hh"
#include "util.hh"
#include "xatom.hh"
static bool running = True;
static int anotherWMRunning(Display *display, XErrorEvent *) {
- fprintf(stderr, i18n(ScreenSet, ScreenAnotherWMRunning,
+ fprintf(stderr,
"BScreen::BScreen: an error occured while querying the X server.\n"
- " another window manager already running on display %s.\n"),
+ " another window manager already running on display %s.\n",
DisplayString(display));
running = False;
managed = running;
if (! managed) return;
- fprintf(stderr, i18n(ScreenSet, ScreenManagingScreen,
- "BScreen::BScreen: managing screen %d "
- "using visual 0x%lx, depth %d\n"),
+ fprintf(stderr, "BScreen::BScreen: managing screen %d "
+ "using visual 0x%lx, depth %d\n",
getScreenNumber(), XVisualIDFromVisual(getVisual()),
getDepth());
- rootmenu = 0;
-
- resource.mstyle.t_font = resource.mstyle.f_font = resource.tstyle.font =
- resource.wstyle.font = (BFont *) 0;
+ resource.wstyle.font = (BFont *) 0;
geom_pixmap = None;
opGC = XCreateGC(blackbox->getXDisplay(), getRootWindow(),
GCForeground | GCFunction | GCSubwindowMode, &gcv);
- const char *s = i18n(ScreenSet, ScreenPositionLength,
- "0: 0000 x 0: 0000");
+ const char *s = "0: 0000 x 0: 0000";
geom_w = resource.wstyle.font->measureString(s) + resource.bevel_width * 2;
geom_h = resource.wstyle.font->height() + resource.bevel_width * 2;
XSetWindowBackgroundPixmap(blackbox->getXDisplay(),
geom_window, geom_pixmap);
- workspacemenu = new Workspacemenu(this);
- iconmenu = new Iconmenu(this);
- configmenu = new Configmenu(this);
-
if (resource.workspaces > 0) {
for (unsigned int i = 0; i < resource.workspaces; ++i) {
Workspace *wkspc = new Workspace(this, workspacesList.size());
workspacesList.push_back(wkspc);
- workspacemenu->insertWorkspace(wkspc);
- workspacemenu->update();
}
} else {
Workspace *wkspc = new Workspace(this, workspacesList.size());
workspacesList.push_back(wkspc);
- workspacemenu->insertWorkspace(wkspc);
- workspacemenu->update();
}
saveWorkspaceNames();
updateNetizenWorkspaceCount();
- workspacemenu->insert(i18n(IconSet, IconIcons, "Icons"), iconmenu);
- workspacemenu->update();
-
current_workspace = workspacesList.front();
xatom->setValue(getRootWindow(), XAtom::net_current_desktop,
XAtom::cardinal, 0); //first workspace
- workspacemenu->setItemSelected(2, True);
-
- toolbar = new Toolbar(this);
-
- slit = new Slit(this);
-
- InitMenu();
-
raiseWindows(0, 0); // this also initializes the empty stacking list
- rootmenu->update();
updateClientList(); // initialize the client lists, which will be empty
updateAvailableArea();
std::for_each(iconList.begin(), iconList.end(), PointerAssassin());
- std::for_each(netizenList.begin(), netizenList.end(), PointerAssassin());
-
while (! systrayWindowList.empty())
removeSystrayWindow(systrayWindowList[0]);
- delete rootmenu;
- delete workspacemenu;
- delete iconmenu;
- delete configmenu;
- delete slit;
- delete toolbar;
delete image_control;
if (resource.wstyle.font)
delete resource.wstyle.font;
- if (resource.mstyle.t_font)
- delete resource.mstyle.t_font;
- if (resource.mstyle.f_font)
- delete resource.mstyle.f_font;
- if (resource.tstyle.font)
- delete resource.tstyle.font;
#ifdef BITMAPBUTTONS
if (resource.wstyle.close_button.mask != None)
if (resource.wstyle.stick_button.mask != None)
XFreePixmap(blackbox->getXDisplay(), resource.wstyle.stick_button.mask);
- if (resource.tstyle.left_button.mask != None)
- XFreePixmap(blackbox->getXDisplay(), resource.tstyle.left_button.mask);
- if (resource.tstyle.right_button.mask != None)
- XFreePixmap(blackbox->getXDisplay(), resource.tstyle.right_button.mask);
-
- if (resource.mstyle.bullet_image.mask != None)
- XFreePixmap(blackbox->getXDisplay(), resource.mstyle.bullet_image.mask);
- if (resource.mstyle.tick_image.mask != None)
- XFreePixmap(blackbox->getXDisplay(), resource.mstyle.tick_image.mask);
-
resource.wstyle.max_button.mask = resource.wstyle.close_button.mask =
resource.wstyle.icon_button.mask =
resource.wstyle.stick_button.mask = None;
- resource.tstyle.left_button.mask = resource.tstyle.right_button.mask = None;
- resource.mstyle.bullet_image.mask = resource.mstyle.tick_image.mask = None;
#endif // BITMAPBUTTONS
XFreeGC(blackbox->getXDisplay(), opGC);
}
-void BScreen::saveHideToolbar(bool h) {
- resource.hide_toolbar = h;
- if (resource.hide_toolbar)
- toolbar->unmapToolbar();
- else
- toolbar->mapToolbar();
- config->setValue(screenstr + "hideToolbar", resource.hide_toolbar);
-}
-
-
void BScreen::saveWindowToEdgeSnap(int s) {
resource.snap_to_edges = s;
}
-#ifdef HAVE_STRFTIME
void BScreen::saveStrftimeFormat(const std::string& format) {
resource.strftime_format = format;
config->setValue(screenstr + "strftimeFormat", resource.strftime_format);
}
-#else // !HAVE_STRFTIME
-
-void BScreen::saveDateFormat(int f) {
- resource.date_format = f;
- config->setValue(screenstr + "dateFormat",
- resource.date_format == B_EuropeanDate ?
- "European" : "American");
-}
-
-
-void BScreen::saveClock24Hour(bool c) {
- resource.clock24hour = c;
- config->setValue(screenstr + "clockFormat", resource.clock24hour ? 24 : 12);
-}
-#endif // HAVE_STRFTIME
-
void BScreen::saveWorkspaceNames() {
string names;
}
-void BScreen::saveRootMenuButton(unsigned int b) {
- resource.root_menu_button = b;
- const char *but;
- switch (resource.root_menu_button) {
- case 0: but = "None"; break;
- case 1: but = "Left"; break;
- case 2: but = "Middle"; break;
- case 3: default: but = "Right"; break;
- }
- config->setValue(screenstr + "rootMenuButton", but);
-}
-
-
-void BScreen::saveWorkspaceMenuButton(unsigned int b) {
- resource.workspace_menu_button = b;
- const char *but;
- switch (resource.workspace_menu_button) {
- case 0: but = "None"; break;
- case 1: but = "Left"; break;
- case 2: default: but = "Middle"; break;
- case 3: but = "Right"; break;
- }
- config->setValue(screenstr + "workspaceMenuButton", but);
-}
-
-
void BScreen::save_rc(void) {
saveSloppyFocus(resource.sloppy_focus);
saveAutoRaise(resource.auto_raise);
saveFullMax(resource.full_max);
saveFocusNew(resource.focus_new);
saveFocusLast(resource.focus_last);
- saveHideToolbar(resource.hide_toolbar);
saveWindowToWindowSnap(resource.snap_to_windows);
saveWindowToEdgeSnap(resource.snap_to_edges);
saveWindowCornerSnap(resource.window_corner_snap);
saveResistanceSize(resource.resistance_size);
saveRowPlacementDirection(resource.row_direction);
saveColPlacementDirection(resource.col_direction);
-#ifdef HAVE_STRFTIME
saveStrftimeFormat(resource.strftime_format);
-#else // !HAVE_STRFTIME
- saveDateFormat(resource.date_format);
- savwClock24Hour(resource.clock24hour);
-#endif // HAVE_STRFTIME
savePlaceIgnoreShaded(resource.ignore_shaded);
savePlaceIgnoreMaximized(resource.ignore_maximized);
saveAllowScrollLock(resource.allow_scroll_lock);
saveWorkspaceWarping(resource.workspace_warping);
saveRootScrollDirection(resource.root_scroll);
- saveRootMenuButton(resource.root_menu_button);
- saveWorkspaceMenuButton(resource.workspace_menu_button);
-
- toolbar->save_rc();
- slit->save_rc();
}
resource.resize_zones != 4))
resource.resize_zones = 4;
- if (! config->getValue(screenstr + "hideToolbar", resource.hide_toolbar))
- resource.hide_toolbar = false;
-
resource.snap_to_windows = WindowResistance;
if (config->getValue(screenstr + "windowToWindowSnap", s)) {
if (s == "NoSnap")
} else
resource.placement_policy = RowSmartPlacement;
-#ifdef HAVE_STRFTIME
if (! config->getValue(screenstr + "strftimeFormat",
resource.strftime_format))
resource.strftime_format = "%I:%M %p";
-#else // !HAVE_STRFTIME
- long l;
-
- if (config->getValue(screenstr + "dateFormat", s) && s == "European")
- resource.date_format = B_EuropeanDate;
- else
- resource.date_format = B_AmericanDate;
-
- if (! config->getValue(screenstr + "clockFormat", l))
- l = 12;
- resource.clock24hour = l == 24;
-#endif // HAVE_STRFTIME
if (! config->getValue(screenstr + "placementIgnoreShaded",
resource.ignore_shaded))
else if (s == "Reverse")
resource.root_scroll = ReverseScroll;
}
-
- resource.root_menu_button = 3;
- if (config->getValue(screenstr + "rootMenuButton", s)) {
- if (s == "None")
- resource.root_menu_button = 0;
- else if (s == "Left")
- resource.root_menu_button = 1;
- else if (s == "Middle")
- resource.root_menu_button = 2;
- }
-
- resource.workspace_menu_button = 2;
- if (config->getValue(screenstr + "workspaceMenuButton", s)) {
- if (s == "None")
- resource.workspace_menu_button = 0;
- else if (s == "Left")
- resource.workspace_menu_button = 1;
- else if (s == "Right")
- resource.workspace_menu_button = 3;
- }
- // cant both be the same
- if (resource.workspace_menu_button == resource.root_menu_button)
- resource.workspace_menu_button = 0;
}
if (blackbox->isStartup()) return;
load_rc();
- toolbar->load_rc();
- slit->load_rc();
LoadStyle();
// we need to do this explicitly, because just loading this value from the rc
XChangeGC(blackbox->getXDisplay(), opGC,
GCForeground | GCFunction | GCSubwindowMode, &gcv);
- const char *s = i18n(ScreenSet, ScreenPositionLength,
- "0: 0000 x 0: 0000");
+ const char *s = "0: 0000 x 0: 0000";
geom_w = resource.wstyle.font->measureString(s) + resource.bevel_width * 2;
geom_h = resource.wstyle.font->height() + resource.bevel_width * 2;
XSetWindowBorder(blackbox->getXDisplay(), geom_window,
resource.border_color.pixel());
- workspacemenu->reconfigure();
- iconmenu->reconfigure();
-
typedef std::vector<int> SubList;
SubList remember_subs;
- // save the current open menus
- Basemenu *menu = rootmenu;
- int submenu;
- while ((submenu = menu->getCurrentSubmenu()) >= 0) {
- remember_subs.push_back(submenu);
- menu = menu->find(submenu)->submenu();
- assert(menu);
- }
-
- InitMenu();
raiseWindows(0, 0);
- rootmenu->reconfigure();
-
- // reopen the saved menus
- menu = rootmenu;
- const SubList::iterator subs_end = remember_subs.end();
- for (SubList::iterator it = remember_subs.begin(); it != subs_end; ++it) {
- menu->drawSubmenu(*it);
- menu = menu->find(*it)->submenu();
- if (! menu)
- break;
- }
-
- configmenu->reconfigure();
-
- toolbar->reconfigure();
-
- slit->reconfigure();
std::for_each(workspacesList.begin(), workspacesList.end(),
std::mem_fun(&Workspace::reconfigure));
}
-void BScreen::rereadMenu(void) {
- InitMenu();
- raiseWindows(0, 0);
-
- rootmenu->reconfigure();
-}
-
-
void BScreen::LoadStyle(void) {
Configuration style(False);
// load fonts/fontsets
if (resource.wstyle.font)
delete resource.wstyle.font;
- if (resource.tstyle.font)
- delete resource.tstyle.font;
- if (resource.mstyle.f_font)
- delete resource.mstyle.f_font;
- if (resource.mstyle.t_font)
- delete resource.mstyle.t_font;
- resource.wstyle.font = resource.tstyle.font = resource.mstyle.f_font =
- resource.mstyle.t_font = (BFont *) 0;
resource.wstyle.font = readDatabaseFont("window.", style);
- resource.tstyle.font = readDatabaseFont("toolbar.", style);
- resource.mstyle.t_font = readDatabaseFont("menu.title.", style);
- resource.mstyle.f_font = readDatabaseFont("menu.frame.", style);
// load window config
resource.wstyle.t_focus =
if (resource.wstyle.h_unfocus.texture() == BTexture::Parent_Relative)
resource.wstyle.h_unfocus = resource.wstyle.f_unfocus;
- // load toolbar config
-#ifdef BITMAPBUTTONS
- if (resource.tstyle.left_button.mask != None)
- XFreePixmap(blackbox->getXDisplay(), resource.tstyle.left_button.mask);
- if (resource.tstyle.right_button.mask != None)
- XFreePixmap(blackbox->getXDisplay(), resource.tstyle.right_button.mask);
-#endif // BITMAPBUTTONS
-
- resource.tstyle.toolbar =
- readDatabaseTexture("toolbar", "black", style);
- resource.tstyle.label =
- readDatabaseTexture("toolbar.label", "black", style);
- resource.tstyle.window =
- readDatabaseTexture("toolbar.windowLabel", "black", style);
- resource.tstyle.button =
- readDatabaseTexture("toolbar.button", "white", style);
- resource.tstyle.pressed =
- readDatabaseTexture("toolbar.button.pressed", "black", style);
- resource.tstyle.clock =
- readDatabaseTexture("toolbar.clock", "black", style);
- resource.tstyle.l_text =
- readDatabaseColor("toolbar.label.textColor", "white", style);
- resource.tstyle.w_text =
- readDatabaseColor("toolbar.windowLabel.textColor", "white", style);
- resource.tstyle.c_text =
- readDatabaseColor("toolbar.clock.textColor", "white", style);
- resource.tstyle.b_pic =
- readDatabaseColor("toolbar.button.picColor", "black", style);
-
-#ifdef BITMAPBUTTONS
- readDatabaseMask("toolbar.button.left.mask", resource.tstyle.left_button,
- style);
- readDatabaseMask("toolbar.button.right.mask", resource.tstyle.right_button,
- style);
-#endif // BITMAPBUTTONS
-
- resource.tstyle.justify = LeftJustify;
- if (style.getValue("toolbar.justify", s)) {
- if (s == "right" || s == "Right")
- resource.tstyle.justify = RightJustify;
- else if (s == "center" || s == "Center")
- resource.tstyle.justify = CenterJustify;
- }
-
- // sanity checks
- if (resource.tstyle.toolbar.texture() == BTexture::Parent_Relative) {
- resource.tstyle.toolbar = BTexture("solid flat", getBaseDisplay(),
- getScreenNumber(), image_control);
- resource.tstyle.toolbar.setColor(BColor("black", getBaseDisplay(),
- getScreenNumber()));
- }
-
- // load menu config
-#ifdef BITMAPBUTTONS
- if (resource.mstyle.bullet_image.mask != None)
- XFreePixmap(blackbox->getXDisplay(), resource.mstyle.bullet_image.mask);
- if (resource.mstyle.tick_image.mask != None)
- XFreePixmap(blackbox->getXDisplay(), resource.mstyle.tick_image.mask);
-#endif // BITMAPBUTTONS
-
- resource.mstyle.title =
- readDatabaseTexture("menu.title", "white", style);
- resource.mstyle.frame =
- readDatabaseTexture("menu.frame", "black", style);
- resource.mstyle.hilite =
- readDatabaseTexture("menu.hilite", "white", style);
- resource.mstyle.t_text =
- readDatabaseColor("menu.title.textColor", "black", style);
- resource.mstyle.f_text =
- readDatabaseColor("menu.frame.textColor", "white", style);
- resource.mstyle.d_text =
- readDatabaseColor("menu.frame.disableColor", "black", style);
- resource.mstyle.h_text =
- readDatabaseColor("menu.hilite.textColor", "black", style);
-
-#ifdef BITMAPBUTTONS
- readDatabaseMask("menu.arrow.mask", resource.mstyle.bullet_image, style);
- readDatabaseMask("menu.selected.mask", resource.mstyle.tick_image, style);
-#endif // BITMAPBUTTONS
-
- resource.mstyle.t_justify = LeftJustify;
- if (style.getValue("menu.title.justify", s)) {
- if (s == "right" || s == "Right")
- resource.mstyle.t_justify = RightJustify;
- else if (s == "center" || s == "Center")
- resource.mstyle.t_justify = CenterJustify;
- }
-
- resource.mstyle.f_justify = LeftJustify;
- if (style.getValue("menu.frame.justify", s)) {
- if (s == "right" || s == "Right")
- resource.mstyle.f_justify = RightJustify;
- else if (s == "center" || s == "Center")
- resource.mstyle.f_justify = CenterJustify;
- }
-
- resource.mstyle.bullet = Basemenu::Triangle;
- if (style.getValue("menu.bullet", s)) {
- if (s == "empty" || s == "Empty")
- resource.mstyle.bullet = Basemenu::Empty;
- else if (s == "square" || s == "Square")
- resource.mstyle.bullet = Basemenu::Square;
- else if (s == "diamond" || s == "Diamond")
- resource.mstyle.bullet = Basemenu::Diamond;
- }
-
- resource.mstyle.bullet_pos = Basemenu::Left;
- if (style.getValue("menu.bullet.position", s)) {
- if (s == "right" || s == "Right")
- resource.mstyle.bullet_pos = Basemenu::Right;
- }
-
- // sanity checks
- if (resource.mstyle.frame.texture() == BTexture::Parent_Relative) {
- resource.mstyle.frame = BTexture("solid flat", getBaseDisplay(),
- getScreenNumber(), image_control);
- resource.mstyle.frame.setColor(BColor("black", getBaseDisplay(),
- getScreenNumber()));
- }
-
resource.border_color =
readDatabaseColor("borderColor", "black", style);
w->setWindowNumber(iconList.size());
iconList.push_back(w);
-
- const char* title = w->getIconTitle();
- iconmenu->insert(title);
- iconmenu->update();
}
iconList.remove(w);
- iconmenu->remove(w->getWindowNumber());
- iconmenu->update();
-
BlackboxWindowList::iterator it = iconList.begin(),
end = iconList.end();
for (int i = 0; it != end; ++it)
saveWorkspaces(getWorkspaceCount());
saveWorkspaceNames();
- workspacemenu->insertWorkspace(wkspc);
- workspacemenu->update();
-
- toolbar->reconfigure();
-
- updateNetizenWorkspaceCount();
-
return workspacesList.size();
}
wkspc->removeAll();
- workspacemenu->removeWorkspace(wkspc);
- workspacemenu->update();
-
workspacesList.pop_back();
delete wkspc;
saveWorkspaces(getWorkspaceCount());
saveWorkspaceNames();
- toolbar->reconfigure();
-
updateNetizenWorkspaceCount();
return workspacesList.size();
blackbox->setFocusedWindow((BlackboxWindow *) 0);
current_workspace->hideAll();
- workspacemenu->setItemSelected(current_workspace->getID() + 2, False);
current_workspace = getWorkspace(id);
xatom->setValue(getRootWindow(), XAtom::net_current_desktop,
XAtom::cardinal, id);
- workspacemenu->setItemSelected(current_workspace->getID() + 2, True);
- toolbar->redrawWorkspaceLabel(True);
-
current_workspace->showAll();
int x, y, rx, ry;
blackbox->setFocusedWindow(win);
else
blackbox->setFocusedWindow((BlackboxWindow *) 0);
-
- updateNetizenCurrentWorkspace();
}
XWMHints *wmhint = XGetWMHints(blackbox->getXDisplay(), w);
if (wmhint && (wmhint->flags & StateHint) &&
wmhint->initial_state == WithdrawnState) {
- slit->addClient(w);
+ //slit->addClient(w);
return;
}
if (blackbox->getFocusedWindow() == w)
blackbox->setFocusedWindow((BlackboxWindow *) 0);
- removeNetizen(w->getClientWindow());
-
/*
some managed windows can also be window group controllers. when
unmanaging such windows, we should also delete the window group.
}
-void BScreen::addNetizen(Netizen *n) {
- netizenList.push_back(n);
-
- n->sendWorkspaceCount();
- n->sendCurrentWorkspace();
-
- WorkspaceList::iterator it = workspacesList.begin();
- const WorkspaceList::iterator end = workspacesList.end();
- for (; it != end; ++it)
- (*it)->sendWindowList(*n);
-
- Window f = ((blackbox->getFocusedWindow()) ?
- blackbox->getFocusedWindow()->getClientWindow() : None);
- n->sendWindowFocus(f);
-}
-
-
-void BScreen::removeNetizen(Window w) {
- NetizenList::iterator it = netizenList.begin();
- for (; it != netizenList.end(); ++it) {
- if ((*it)->getWindowID() == w) {
- delete *it;
- netizenList.erase(it);
- break;
- }
- }
-}
-
-
void BScreen::updateWorkArea(void) {
if (workspacesList.size() > 0) {
unsigned long *dims = new unsigned long[4 * workspacesList.size()];
}
-void BScreen::updateNetizenCurrentWorkspace(void) {
- std::for_each(netizenList.begin(), netizenList.end(),
- std::mem_fun(&Netizen::sendCurrentWorkspace));
-}
-
-
void BScreen::updateNetizenWorkspaceCount(void) {
xatom->setValue(getRootWindow(), XAtom::net_number_of_desktops,
XAtom::cardinal, workspacesList.size());
updateWorkArea();
-
- std::for_each(netizenList.begin(), netizenList.end(),
- std::mem_fun(&Netizen::sendWorkspaceCount));
}
xatom->setValue(getRootWindow(), XAtom::net_active_window,
XAtom::window, f);
-
- NetizenList::iterator it = netizenList.begin();
- for (; it != netizenList.end(); ++it)
- (*it)->sendWindowFocus(f);
-}
-
-
-void BScreen::updateNetizenWindowAdd(Window w, unsigned long p) {
- NetizenList::iterator it = netizenList.begin();
- for (; it != netizenList.end(); ++it) {
- (*it)->sendWindowAdd(w, p);
- }
-}
-
-
-void BScreen::updateNetizenWindowDel(Window w) {
- NetizenList::iterator it = netizenList.begin();
- for (; it != netizenList.end(); ++it)
- (*it)->sendWindowDel(w);
-}
-
-
-void BScreen::updateNetizenWindowRaise(Window w) {
- NetizenList::iterator it = netizenList.begin();
- for (; it != netizenList.end(); ++it)
- (*it)->sendWindowRaise(w);
-}
-
-
-void BScreen::updateNetizenWindowLower(Window w) {
- NetizenList::iterator it = netizenList.begin();
- for (; it != netizenList.end(); ++it)
- (*it)->sendWindowLower(w);
-}
-
-
-void BScreen::updateNetizenConfigNotify(XEvent *e) {
- NetizenList::iterator it = netizenList.begin();
- for (; it != netizenList.end(); ++it)
- (*it)->sendConfigNotify(e);
}
#ifdef XINERAMA
++bbwins;
#endif // XINERAMA
-#ifdef XFT
- ++bbwins;
-#endif // XFT
Window *session_stack = new
- Window[(num + workspacesList.size() + rootmenuList.size() +
- specialWindowList.size() + bbwins)];
+ Window[(num + specialWindowList.size() + bbwins)];
unsigned int i = 0, k = num;
- XRaiseWindow(blackbox->getXDisplay(), iconmenu->getWindowID());
- *(session_stack + i++) = iconmenu->getWindowID();
-
- WorkspaceList::iterator wit = workspacesList.begin();
- const WorkspaceList::iterator w_end = workspacesList.end();
- for (; wit != w_end; ++wit)
- *(session_stack + i++) = (*wit)->getMenu()->getWindowID();
-
- *(session_stack + i++) = workspacemenu->getWindowID();
-
- *(session_stack + i++) = configmenu->getFocusmenu()->getWindowID();
- *(session_stack + i++) = configmenu->getPlacementmenu()->getWindowID();
- *(session_stack + i++) = configmenu->getWindowSnapmenu()->getWindowID();
- *(session_stack + i++) = configmenu->getEdgeSnapmenu()->getWindowID();
-#ifdef XINERAMA
- *(session_stack + i++) = configmenu->getXineramamenu()->getWindowID();
-#endif // XINERAMA
-#ifdef XFT
- *(session_stack + i++) = configmenu->getXftmenu()->getWindowID();
-#endif // XFT
- *(session_stack + i++) = configmenu->getWindowID();
-
- *(session_stack + i++) = slit->getMenu()->getDirectionmenu()->getWindowID();
- *(session_stack + i++) = slit->getMenu()->getPlacementmenu()->getWindowID();
- *(session_stack + i++) = slit->getMenu()->getWindowID();
-
- *(session_stack + i++) =
- toolbar->getMenu()->getPlacementmenu()->getWindowID();
- *(session_stack + i++) = toolbar->getMenu()->getWindowID();
-
- RootmenuList::iterator rit = rootmenuList.begin();
- for (; rit != rootmenuList.end(); ++rit)
- *(session_stack + i++) = (*rit)->getWindowID();
- *(session_stack + i++) = rootmenu->getWindowID();
-
- if (toolbar->isOnTop())
- *(session_stack + i++) = toolbar->getWindowID();
-
- if (slit->isOnTop())
- *(session_stack + i++) = slit->getWindowID();
-
WindowList::iterator sit, send = specialWindowList.end();
for (sit = specialWindowList.begin(); sit != send; ++sit)
*(session_stack + i++) = *sit;
void BScreen::propagateWindowName(const BlackboxWindow *bw) {
if (bw->isIconic()) {
- iconmenu->changeItemLabel(bw->getWindowNumber(), bw->getIconTitle());
- iconmenu->update();
} else {
- Clientmenu *clientmenu = getWorkspace(bw->getWorkspaceNumber())->getMenu();
- clientmenu->changeItemLabel(bw->getWindowNumber(), bw->getTitle());
- clientmenu->update();
-
- if (blackbox->getFocusedWindow() == bw)
- toolbar->redrawWindowLabel(True);
}
}
}
-void BScreen::InitMenu(void) {
- if (rootmenu) {
- rootmenuList.clear();
-
- while (rootmenu->getCount())
- rootmenu->remove(0);
- } else {
- rootmenu = new Rootmenu(this);
- }
- bool defaultMenu = True;
-
- FILE *menu_file = (FILE *) 0;
- const char *menu_filename = blackbox->getMenuFilename();
-
- if (menu_filename)
- if (! (menu_file = fopen(menu_filename, "r")))
- perror(menu_filename);
- if (! menu_file) { // opening the menu file failed, try the default menu
- menu_filename = DEFAULTMENU;
- if (! (menu_file = fopen(menu_filename, "r")))
- perror(menu_filename);
- }
-
- if (menu_file) {
- if (feof(menu_file)) {
- fprintf(stderr, i18n(ScreenSet, ScreenEmptyMenuFile,
- "%s: Empty menu file"),
- menu_filename);
- } else {
- char line[1024], label[1024];
- memset(line, 0, 1024);
- memset(label, 0, 1024);
-
- while (fgets(line, 1024, menu_file) && ! feof(menu_file)) {
- if (line[0] == '#')
- continue;
-
- int i, key = 0, index = -1, len = strlen(line);
-
- for (i = 0; i < len; i++) {
- if (line[i] == '[') index = 0;
- else if (line[i] == ']') break;
- else if (line[i] != ' ')
- if (index++ >= 0)
- key += tolower(line[i]);
- }
-
- if (key == 517) { // [begin]
- index = -1;
- for (i = index; i < len; i++) {
- if (line[i] == '(') index = 0;
- else if (line[i] == ')') break;
- else if (index++ >= 0) {
- if (line[i] == '\\' && i < len - 1) i++;
- label[index - 1] = line[i];
- }
- }
-
- if (index == -1) index = 0;
- label[index] = '\0';
-
- rootmenu->setLabel(label);
- defaultMenu = parseMenuFile(menu_file, rootmenu);
- if (! defaultMenu)
- blackbox->addMenuTimestamp(menu_filename);
- break;
- }
- }
- }
- fclose(menu_file);
- }
-
- if (defaultMenu) {
- rootmenu->setInternalMenu();
- rootmenu->insert(i18n(ScreenSet, Screenxterm, "xterm"),
- BScreen::Execute,
- i18n(ScreenSet, Screenxterm, "xterm"));
- rootmenu->insert(i18n(ScreenSet, ScreenRestart, "Restart"),
- BScreen::Restart);
- rootmenu->insert(i18n(ScreenSet, ScreenExit, "Exit"),
- BScreen::Exit);
- rootmenu->setLabel(i18n(BasemenuSet, BasemenuBlackboxMenu,
- "Openbox Menu"));
- }
-}
-
-
-static
-size_t string_within(char begin, char end,
- const char *input, size_t start_at, size_t length,
- char *output) {
- bool parse = False;
- size_t index = 0;
- size_t i = start_at;
- for (; i < length; ++i) {
- if (input[i] == begin) {
- parse = True;
- } else if (input[i] == end) {
- break;
- } else if (parse) {
- if (input[i] == '\\' && i < length - 1) i++;
- output[index++] = input[i];
- }
- }
-
- if (parse)
- output[index] = '\0';
- else
- output[0] = '\0';
-
- return i;
-}
-
-
-bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) {
- char line[1024], keyword[1024], label[1024], command[1024];
- bool done = False;
-
- while (! (done || feof(file))) {
- memset(line, 0, 1024);
- memset(label, 0, 1024);
- memset(command, 0, 1024);
-
- if (! fgets(line, 1024, file))
- continue;
-
- if (line[0] == '#') // comment, skip it
- continue;
-
- size_t line_length = strlen(line);
- unsigned int key = 0;
-
- // get the keyword enclosed in []'s
- size_t pos = string_within('[', ']', line, 0, line_length, keyword);
-
- if (keyword[0] == '\0') { // no keyword, no menu entry
- continue;
- } else {
- size_t len = strlen(keyword);
- for (size_t i = 0; i < len; ++i) {
- if (keyword[i] != ' ')
- key += tolower(keyword[i]);
- }
- }
-
- // get the label enclosed in ()'s
- pos = string_within('(', ')', line, pos, line_length, label);
-
- // get the command enclosed in {}'s
- pos = string_within('{', '}', line, pos, line_length, command);
-
- switch (key) {
- case 311: // end
- done = True;
-
- break;
-
- case 333: // nop
- if (! *label)
- label[0] = '\0';
- menu->insert(label);
-
- break;
-
- case 421: // exec
- if (! (*label && *command)) {
- fprintf(stderr, i18n(ScreenSet, ScreenEXECError,
- "BScreen::parseMenuFile: [exec] error, "
- "no menu label and/or command defined\n"));
- continue;
- }
-
- menu->insert(label, BScreen::Execute, command);
-
- break;
-
- case 442: // exit
- if (! *label) {
- fprintf(stderr, i18n(ScreenSet, ScreenEXITError,
- "BScreen::parseMenuFile: [exit] error, "
- "no menu label defined\n"));
- continue;
- }
-
- menu->insert(label, BScreen::Exit);
-
- break;
-
- case 561: { // style
- if (! (*label && *command)) {
- fprintf(stderr,
- i18n(ScreenSet, ScreenSTYLEError,
- "BScreen::parseMenuFile: [style] error, "
- "no menu label and/or filename defined\n"));
- continue;
- }
-
- string style = expandTilde(command);
-
- menu->insert(label, BScreen::SetStyle, style.c_str());
- }
- break;
-
- case 630: // config
- if (! *label) {
- fprintf(stderr, i18n(ScreenSet, ScreenCONFIGError,
- "BScreen::parseMenufile: [config] error, "
- "no label defined"));
- continue;
- }
-
- menu->insert(label, configmenu);
-
- break;
-
- case 740: { // include
- if (! *label) {
- fprintf(stderr, i18n(ScreenSet, ScreenINCLUDEError,
- "BScreen::parseMenuFile: [include] error, "
- "no filename defined\n"));
- continue;
- }
-
- string newfile = expandTilde(label);
- FILE *submenufile = fopen(newfile.c_str(), "r");
-
- if (! submenufile) {
- perror(newfile.c_str());
- continue;
- }
-
- struct stat buf;
- if (fstat(fileno(submenufile), &buf) ||
- ! S_ISREG(buf.st_mode)) {
- fprintf(stderr,
- i18n(ScreenSet, ScreenINCLUDEErrorReg,
- "BScreen::parseMenuFile: [include] error: "
- "'%s' is not a regular file\n"), newfile.c_str());
- break;
- }
-
- if (! feof(submenufile)) {
- if (! parseMenuFile(submenufile, menu))
- blackbox->addMenuTimestamp(newfile);
-
- fclose(submenufile);
- }
- }
-
- break;
-
- case 767: { // submenu
- if (! *label) {
- fprintf(stderr, i18n(ScreenSet, ScreenSUBMENUError,
- "BScreen::parseMenuFile: [submenu] error, "
- "no menu label defined\n"));
- continue;
- }
-
- Rootmenu *submenu = new Rootmenu(this);
-
- if (*command)
- submenu->setLabel(command);
- else
- submenu->setLabel(label);
-
- parseMenuFile(file, submenu);
- submenu->update();
- menu->insert(label, submenu);
- rootmenuList.push_back(submenu);
- }
-
- break;
-
- case 773: { // restart
- if (! *label) {
- fprintf(stderr, i18n(ScreenSet, ScreenRESTARTError,
- "BScreen::parseMenuFile: [restart] error, "
- "no menu label defined\n"));
- continue;
- }
-
- if (*command)
- menu->insert(label, BScreen::RestartOther, command);
- else
- menu->insert(label, BScreen::Restart);
- }
-
- break;
-
- case 845: { // reconfig
- if (! *label) {
- fprintf(stderr,
- i18n(ScreenSet, ScreenRECONFIGError,
- "BScreen::parseMenuFile: [reconfig] error, "
- "no menu label defined\n"));
- continue;
- }
-
- menu->insert(label, BScreen::Reconfigure);
- }
-
- break;
-
- case 995: // stylesdir
- case 1113: { // stylesmenu
- bool newmenu = ((key == 1113) ? True : False);
-
- if (! *label || (! *command && newmenu)) {
- fprintf(stderr,
- i18n(ScreenSet, ScreenSTYLESDIRError,
- "BScreen::parseMenuFile: [stylesdir/stylesmenu]"
- " error, no directory defined\n"));
- continue;
- }
-
- char *directory = ((newmenu) ? command : label);
-
- string stylesdir = expandTilde(directory);
-
- struct stat statbuf;
-
- if (stat(stylesdir.c_str(), &statbuf) == -1) {
- fprintf(stderr,
- i18n(ScreenSet, ScreenSTYLESDIRErrorNoExist,
- "BScreen::parseMenuFile: [stylesdir/stylesmenu]"
- " error, %s does not exist\n"), stylesdir.c_str());
- continue;
- }
- if (! S_ISDIR(statbuf.st_mode)) {
- fprintf(stderr,
- i18n(ScreenSet, ScreenSTYLESDIRErrorNotDir,
- "BScreen::parseMenuFile:"
- " [stylesdir/stylesmenu] error, %s is not a"
- " directory\n"), stylesdir.c_str());
- continue;
- }
-
- Rootmenu *stylesmenu;
-
- if (newmenu)
- stylesmenu = new Rootmenu(this);
- else
- stylesmenu = menu;
-
- DIR *d = opendir(stylesdir.c_str());
- struct dirent *p;
- std::vector<string> ls;
-
- while((p = readdir(d)))
- ls.push_back(p->d_name);
-
- closedir(d);
-
- std::sort(ls.begin(), ls.end());
-
- std::vector<string>::iterator it = ls.begin(),
- end = ls.end();
- for (; it != end; ++it) {
- const string& fname = *it;
-
- if (fname[fname.size()-1] == '~')
- continue;
-
- string style = stylesdir;
- style += '/';
- style += fname;
-
- if (! stat(style.c_str(), &statbuf) && S_ISREG(statbuf.st_mode))
- stylesmenu->insert(fname, BScreen::SetStyle, style);
- }
-
- stylesmenu->update();
-
- if (newmenu) {
- stylesmenu->setLabel(label);
- menu->insert(label, stylesmenu);
- rootmenuList.push_back(stylesmenu);
- }
-
- blackbox->addMenuTimestamp(stylesdir);
- }
- break;
-
- case 1090: { // workspaces
- if (! *label) {
- fprintf(stderr,
- i18n(ScreenSet, ScreenWORKSPACESError,
- "BScreen:parseMenuFile: [workspaces] error, "
- "no menu label defined\n"));
- continue;
- }
-
- menu->insert(label, workspacemenu);
- }
- break;
- }
- }
-
- return ((menu->getCount() == 0) ? True : False);
-}
-
-
void BScreen::shutdown(void) {
XSelectInput(blackbox->getXDisplay(), getRootWindow(), NoEventMask);
XSync(blackbox->getXDisplay(), False);
assert(win);
unmanageWindow(win, True);
}
-
- slit->shutdown();
}
char label[1024];
- sprintf(label, i18n(ScreenSet, ScreenPositionFormat,
- "X: %4d x Y: %4d"), x, y);
+ sprintf(label, "X: %4d x Y: %4d", x, y);
XClearWindow(blackbox->getXDisplay(), geom_window);
char label[1024];
- sprintf(label, i18n(ScreenSet, ScreenGeometryFormat,
- "W: %4d x H: %4d"), gx, gy);
+ sprintf(label, "W: %4d x H: %4d", gx, gy);
XClearWindow(blackbox->getXDisplay(), geom_window);
if (! isRootColormapInstalled())
image_control->installRootColormap();
- if (workspacemenu->isVisible())
- workspacemenu->hide();
-
- if (rootmenu->isVisible())
- rootmenu->hide();
// mouse wheel up
} else if ((xbutton->button == 4 && resource.root_scroll == NormalScroll) ||
(xbutton->button == 5 && resource.root_scroll == ReverseScroll)) {
else
changeWorkspaceID(getCurrentWorkspaceID() - 1);
}
-
- if (resource.root_menu_button > 0 &&
- xbutton->button == resource.root_menu_button)
- showRootMenu(xbutton->x_root, xbutton->y_root);
- else if (resource.workspace_menu_button > 0 &&
- xbutton->button == resource.workspace_menu_button)
- showWorkspaceMenu(xbutton->x_root, xbutton->y_root);
-}
-
-
-void BScreen::showWorkspaceMenu(int x, int y) {
- int mx = x - (workspacemenu->getWidth() / 2);
- int my = y - (workspacemenu->getTitleHeight() / 2);
-
- if (mx < 0) mx = 0;
- if (my < 0) my = 0;
-
- if (mx + workspacemenu->getWidth() > getWidth())
- mx = getWidth() - workspacemenu->getWidth() - getBorderWidth();
-
- if (my + workspacemenu->getHeight() > getHeight())
- my = getHeight() - workspacemenu->getHeight() - getBorderWidth();
-
- workspacemenu->move(mx, my);
-
- if (! workspacemenu->isVisible()) {
- workspacemenu->removeParent();
- workspacemenu->show();
- }
-}
-
-
-void BScreen::showRootMenu(int x, int y) {
- int mx = x - (rootmenu->getWidth() / 2);
- int my = y - (rootmenu->getTitleHeight() / 2);
-
- if (mx < 0) mx = 0;
- if (my < 0) my = 0;
-
- if (mx + rootmenu->getWidth() > getWidth())
- mx = getWidth() - rootmenu->getWidth() - getBorderWidth();
-
- if (my + rootmenu->getHeight() > getHeight())
- my = getHeight() - rootmenu->getHeight() - getBorderWidth();
-
- rootmenu->move(mx, my);
-
- if (! rootmenu->isVisible()) {
- blackbox->checkMenu();
- rootmenu->show();
- }
}
const WorkspaceList::iterator end = workspacesList.end();
for (; it != end; ++it) {
(*it)->readName(); // re-read its name from the window property
- workspacemenu->changeWorkspaceLabel((*it)->getID(), (*it)->getName());
+ //workspacemenu->changeWorkspaceLabel((*it)->getID(), (*it)->getName());
}
- workspacemenu->update();
- toolbar->reconfigure();
+ //workspacemenu->update();
saveWorkspaceNames();
}
}
string s;
-#ifdef XFT
int i;
if (style.getValue(rbasename + "xft.font", s) &&
style.getValue(rbasename + "xft.size", i)) {
tint, resource.aa_fonts);
if (b->valid())
return b;
- else
- delete b; // fall back to the normal X font stuff
+ delete b;
}
-#endif // XFT
-
- style.getValue(rbasename + "font", s);
- // if this fails, a blank string will be used, which will cause the fallback
- // font to load.
-
- BFont *b = new BFont(blackbox->getXDisplay(), this, s);
- if (! b->valid())
- exit(2); // can't continue without a font
- return b;
+
+ exit(2); // can't continue without a font
}
#include "color.hh"
#include "texture.hh"
#include "image.hh"
-#include "configmenu.hh"
-#include "iconmenu.hh"
-#include "netizen.hh"
-#include "rootmenu.hh"
#include "timer.hh"
#include "workspace.hh"
-#include "workspacemenu.hh"
#include "blackbox.hh"
class Slit; // forward reference
unsigned int max_length, unsigned int modifier) const;
};
-struct ToolbarStyle {
- BColor l_text, w_text, c_text, b_pic;
- BTexture toolbar, label, window, button, pressed, clock;
-
-#ifdef BITMAPBUTTONS
- PixmapMask left_button, right_button;
-#endif // BITMAPBUTTONS
-
- BFont *font;
-
- TextJustify justify;
-
- void doJustify(const std::string &text, int &start_pos,
- unsigned int max_length, unsigned int modifier) const;
-};
-
-struct MenuStyle {
- BColor t_text, f_text, h_text, d_text;
- BTexture title, frame, hilite;
-
-#ifdef BITMAPBUTTONS
- PixmapMask bullet_image, tick_image;
-#endif // BITMAPBUTTONS
-
- BFont *t_font, *f_font;
-
- TextJustify t_justify, f_justify;
- int bullet, bullet_pos;
-};
-
class BScreen : public ScreenInfo {
private:
bool root_colormap_installed, managed, geom_visible;
Blackbox *blackbox;
BImageControl *image_control;
- Configmenu *configmenu;
- Iconmenu *iconmenu;
- Rootmenu *rootmenu;
Configuration *config;
XAtom *xatom;
- typedef std::list<Rootmenu*> RootmenuList;
- RootmenuList rootmenuList;
-
- typedef std::list<Netizen*> NetizenList;
- NetizenList netizenList;
BlackboxWindowList iconList, windowList;
typedef std::vector<Window> WindowList;
WindowList specialWindowList, desktopWindowList, systrayWindowList;
- Slit *slit;
- Toolbar *toolbar;
Workspace *current_workspace;
- Workspacemenu *workspacemenu;
unsigned int geom_w, geom_h;
unsigned long event_mask;
struct screen_resource {
WindowStyle wstyle;
- ToolbarStyle tstyle;
- MenuStyle mstyle;
bool sloppy_focus, auto_raise, auto_edge_balance, ordered_dither,
opaque_move, full_max, focus_new, focus_last, click_raise,
- allow_scroll_lock, hide_toolbar, window_corner_snap, aa_fonts,
+ allow_scroll_lock, window_corner_snap, aa_fonts,
ignore_shaded, ignore_maximized, workspace_warping, shadow_fonts;
int snap_to_windows, snap_to_edges;
BColor border_color;
unsigned int workspaces;
- int toolbar_placement, toolbar_width_percent, placement_policy,
+ int placement_policy,
snap_threshold, row_direction, col_direction, root_scroll,
resistance_size;
unsigned int handle_width, bevel_width, frame_width, border_width,
resize_zones;
- unsigned int root_menu_button, workspace_menu_button;
-
-#ifdef HAVE_STRFTIME
std::string strftime_format;
-#else // !HAVE_STRFTIME
- bool clock24hour;
- int date_format;
-#endif // HAVE_STRFTIME
} resource;
std::string screenstr;
BScreen(const BScreen&);
BScreen& operator=(const BScreen&);
- bool parseMenuFile(FILE *file, Rootmenu *menu);
-
#ifdef BITMAPBUTTONS
void readDatabaseMask(const std::string &rname,
PixmapMask &pixmapMask,
BFont *readDatabaseFont(const std::string &rbasename,
const Configuration &style);
- void InitMenu(void);
void LoadStyle(void);
void updateWorkArea(void);
+
public:
+ // XXX: temporary
+ void updateNetizenWorkspaceCount();
+ void updateNetizenWindowFocus();
+
+
enum { WindowNoSnap = 0, WindowSnap, WindowResistance };
enum { RowSmartPlacement = 1, ColSmartPlacement, CascadePlacement,
UnderMousePlacement, ClickMousePlacement, LeftRight, RightLeft,
inline bool doFullMax(void) const { return resource.full_max; }
inline bool doFocusNew(void) const { return resource.focus_new; }
inline bool doFocusLast(void) const { return resource.focus_last; }
- inline bool doHideToolbar(void) const { return resource.hide_toolbar; }
inline int getWindowToWindowSnap(void) const
{ return resource.snap_to_windows; }
inline int getWindowToEdgeSnap(void) const
inline bool doWorkspaceWarping(void) const
{ return resource.workspace_warping; }
inline int rootScrollDirection(void) const { return resource.root_scroll; }
- inline unsigned int rootMenuButton(void) const
- { return resource.root_menu_button; }
- inline unsigned int workspaceMenuButton(void) const
- { return resource.workspace_menu_button; }
inline const GC &getOpGC(void) const { return opGC; }
inline Blackbox *getBlackbox(void) { return blackbox; }
inline BColor *getBorderColor(void) { return &resource.border_color; }
inline BImageControl *getImageControl(void) { return image_control; }
- inline Rootmenu *getRootmenu(void) { return rootmenu; }
-
- inline Slit *getSlit(void) { return slit; }
- inline Toolbar *getToolbar(void) { return toolbar; }
Workspace *getWorkspace(unsigned int index) const;
inline Workspace *getCurrentWorkspace(void) { return current_workspace; }
- inline Workspacemenu *getWorkspacemenu(void) { return workspacemenu; }
-
inline unsigned int getHandleWidth(void) const
{ return resource.handle_width; }
inline unsigned int getBevelWidth(void) const
void saveFullMax(bool f);
void saveFocusNew(bool f);
void saveFocusLast(bool f);
- void saveHideToolbar(bool h);
void saveWindowToEdgeSnap(int s);
void saveWindowToWindowSnap(int s);
void saveWindowCornerSnap(bool s);
void saveAllowScrollLock(bool a);
void saveWorkspaceWarping(bool w);
void saveRootScrollDirection(int d);
- void saveRootMenuButton(unsigned int b);
- void saveWorkspaceMenuButton(unsigned int b);
- inline void iconUpdate(void) { iconmenu->update(); }
-#ifdef HAVE_STRFTIME
inline const char *getStrftimeFormat(void)
{ return resource.strftime_format.c_str(); }
void saveStrftimeFormat(const std::string& format);
-#else // !HAVE_STRFTIME
- inline int getDateFormat(void) { return resource.date_format; }
- inline void saveDateFormat(int f);
- inline bool isClock24Hour(void) { return resource.clock24hour; }
- inline void saveClock24Hour(bool c);
-#endif // HAVE_STRFTIME
inline WindowStyle *getWindowStyle(void) { return &resource.wstyle; }
- inline MenuStyle *getMenuStyle(void) { return &resource.mstyle; }
- inline ToolbarStyle *getToolbarStyle(void) { return &resource.tstyle; }
BlackboxWindow *getIcon(unsigned int index);
void changeWorkspaceID(unsigned int id);
void saveWorkspaceNames(void);
- void addNetizen(Netizen *n);
- void removeNetizen(Window w);
-
void addSystrayWindow(Window window);
void removeSystrayWindow(Window window);
void save_rc(void);
void reconfigure(void);
void toggleFocusModel(FocusModel model);
- void rereadMenu(void);
void shutdown(void);
void showPosition(int x, int y);
void showGeometry(unsigned int gx, unsigned int gy);
void hideGeometry(void);
- void showWorkspaceMenu(int x, int y);
- void showRootMenu(int x, int y);
-
void buttonPressEvent(const XButtonEvent *xbutton);
void propertyNotifyEvent(const XPropertyEvent *pe);
-
- void updateNetizenCurrentWorkspace(void);
- void updateNetizenWorkspaceCount(void);
- void updateNetizenWindowFocus(void);
- void updateNetizenWindowAdd(Window w, unsigned long p);
- void updateNetizenWindowDel(Window w);
- void updateNetizenConfigNotify(XEvent *e);
- void updateNetizenWindowRaise(Window w);
- void updateNetizenWindowLower(Window w);
};
}
#include "blackbox.hh"
-#include "clientmenu.hh"
#include "font.hh"
#include "gccache.hh"
-#include "iconmenu.hh"
#include "image.hh"
#include "screen.hh"
-#include "toolbar.hh"
#include "util.hh"
#include "window.hh"
-#include "windowmenu.hh"
#include "workspace.hh"
-#include "slit.hh"
using std::string;
using std::abs;
current_state = NormalState;
- windowmenu = 0;
-
/*
set the initial size and location of client window (relative to the
_root window_). This position is the reference point used with the
if (flags.maximized && (functions & Func_Maximize))
remaximize();
-
- // create this last so it only needs to be configured once
- windowmenu = new Windowmenu(this);
}
delete timer;
- delete windowmenu;
-
if (client.window_group) {
BWindowGroup *group = blackbox->searchGroup(client.window_group);
if (group) group->removeWindow(this);
ungrabButtons();
grabButtons();
-
- if (windowmenu) {
- windowmenu->move(windowmenu->getX(), frame.rect.y() + frame.title_h);
- windowmenu->reconfigure();
- }
}
return;
}
// fall back to an internal default
- client.title = i18n(WindowSet, WindowUnnamed, "Unnamed");
+ client.title = "Unnamed";
xatom->setValue(client.window, XAtom::net_wm_visible_name, XAtom::utf8,
client.title);
functions |= Func_Close;
} else if (proto[i] == xatom->getAtom(XAtom::wm_take_focus))
flags.send_focus_message = True;
- else if (proto[i] == xatom->getAtom(XAtom::blackbox_structure_messages))
- screen->addNetizen(new Netizen(screen, client.window));
}
XFree(proto);
XSendEvent(blackbox->getXDisplay(), client.window, False,
StructureNotifyMask, &event);
- screen->updateNetizenConfigNotify(&event);
XFlush(blackbox->getXDisplay());
}
}
if (flags.moving)
endMove();
- if (windowmenu) windowmenu->hide();
-
/*
* we don't want this XUnmapWindow call to generate an UnmapNotify event, so
* we need to clear the event mask on client.window for a split second.
XSelectInput(blackbox->getXDisplay(), client.window, event_mask);
XUngrabServer(blackbox->getXDisplay());
-
- if (windowmenu) windowmenu->hide();
}
if (flags.moving)
endMove();
- // handle case where menu is open then the max button is used instead
- if (windowmenu && windowmenu->isVisible()) windowmenu->hide();
-
if (flags.maximized) {
flags.maximized = 0;
if (flags.focused)
blackbox->setFocusedWindow(this);
-
- if (! flags.iconic) {
- // iconic windows arent in a workspace menu!
- if (flags.stuck)
- screen->getCurrentWorkspace()->setFocused(this, isFocused());
- else
- screen->getWorkspace(blackbox_attrib.workspace)->
- setFocused(this, flags.focused);
- }
}
positionButtons(True);
XMapSubwindows(blackbox->getXDisplay(), frame.title);
}
- if (windowmenu) windowmenu->reconfigure();
}
} else if (pe->atom == xatom->getAtom(XAtom::net_wm_strut)) {
updateStrut();
} else if (frame.stick_button == be->window) {
redrawStickyButton(True);
} else if (frame.plate == be->window) {
- if (windowmenu && windowmenu->isVisible()) windowmenu->hide();
-
screen->getWorkspace(blackbox_attrib.workspace)->raiseWindow(this);
XAllowEvents(blackbox->getXDisplay(), ReplayPointer, be->time);
}
}
- if (windowmenu && windowmenu->isVisible()) windowmenu->hide();
-
screen->getWorkspace(blackbox_attrib.workspace)->raiseWindow(this);
}
} else if (be->button == 2 && (be->window != frame.iconify_button) &&
(be->window != frame.close_button) &&
(be->window != frame.stick_button)) {
screen->getWorkspace(blackbox_attrib.workspace)->lowerWindow(this);
- } else if (windowmenu && be->button == 3 &&
- (frame.title == be->window || frame.label == be->window ||
- frame.handle == be->window || frame.window == be->window)) {
- if (windowmenu->isVisible()) {
- windowmenu->hide();
- } else {
- int mx = be->x_root - windowmenu->getWidth() / 2,
- my = be->y_root - windowmenu->getHeight() / 2;
-
- // snap the window menu into a corner/side if necessary
- int left_edge, right_edge, top_edge, bottom_edge;
-
- /*
- the " + (frame.border_w * 2) - 1" bits are to get the proper width
- and height of the menu, as the sizes returned by it do not include
- the borders.
- */
- left_edge = frame.rect.x();
- right_edge = frame.rect.right() -
- (windowmenu->getWidth() + (frame.border_w * 2) - 1);
- top_edge = client.rect.top() - (frame.border_w + frame.mwm_border_w);
- bottom_edge = client.rect.bottom() -
- (windowmenu->getHeight() + (frame.border_w * 2) - 1) +
- (frame.border_w + frame.mwm_border_w);
-
- if (mx < left_edge)
- mx = left_edge;
- else if (mx > right_edge)
- mx = right_edge;
- if (my < top_edge)
- my = top_edge;
- else if (my > bottom_edge)
- my = bottom_edge;
-
- if (my + windowmenu->getHeight() > screen->getHeight())
- my = screen->getHeight() - windowmenu->getHeight() -
- (screen->getBorderWidth() * 2);
-
- windowmenu->move(mx, my);
- windowmenu->show();
- XRaiseWindow(blackbox->getXDisplay(), windowmenu->getWindowID());
- XRaiseWindow(blackbox->getXDisplay(),
- windowmenu->getSendToMenu()->getWindowID());
- }
// mouse wheel up
} else if (be->button == 4) {
if ((be->window == frame.label ||
GrabModeAsync, GrabModeAsync,
None, blackbox->getMoveCursor(), CurrentTime);
- if (windowmenu && windowmenu->isVisible())
- windowmenu->hide();
-
flags.moving = True;
blackbox->setChangingWindow(this);
if (*st_it != this) // don't snap to ourself
rectlist.push_back( (*st_it)->frameRect() );
- // add the toolbar and the slit to the rect list.
- // (only if they are not hidden)
- Toolbar *tbar = screen->getToolbar();
- Slit *slit = screen->getSlit();
- Rect tbar_rect, slit_rect;
- unsigned int bwidth = screen->getBorderWidth() * 2;
-
- if (! (screen->doHideToolbar() || tbar->isHidden())) {
- tbar_rect.setRect(tbar->getX(), tbar->getY(), tbar->getWidth() + bwidth,
- tbar->getHeight() + bwidth);
- rectlist.push_back(tbar_rect);
- }
-
- if (! slit->isHidden()) {
- slit_rect.setRect(slit->getX(), slit->getY(), slit->getWidth() + bwidth,
- slit->getHeight() + bwidth);
- rectlist.push_back(slit_rect);
- }
-
RectList::const_iterator it, end = rectlist.end();
for (it = rectlist.begin(); it != end; ++it) {
bool snapped = False;
#include "basedisplay.hh"
#include "timer.hh"
#include "util.hh"
-#include "windowmenu.hh"
#define MwmHintsFunctions (1l << 0)
#define MwmHintsDecorations (1l << 1)
BlackboxAttributes blackbox_attrib;
Time lastButtonPressTime; // used for double clicks, when were we clicked
- Windowmenu *windowmenu;
unsigned int window_number;
unsigned long current_state;
void redrawWindowFrame(void) const;
void redrawLabel(void) const;
void redrawAllButtons(void) const;
- void BlackboxWindow::redrawButton(bool pressed, Window win,
- Pixmap fppix, unsigned long fppixel,
- Pixmap uppix, unsigned long uppixel,
- Pixmap fpix, unsigned long fpixel,
- Pixmap upix, unsigned long upixel) const;
+ void redrawButton(bool pressed, Window win,
+ Pixmap fppix, unsigned long fppixel,
+ Pixmap uppix, unsigned long uppixel,
+ Pixmap fpix, unsigned long fpixel,
+ Pixmap upix, unsigned long upixel) const;
void redrawCloseButton(bool pressed) const;
void redrawIconifyButton(bool pressed) const;
void redrawMaximizeButton(bool pressed) const;
inline Window getClientWindow(void) const { return client.window; }
inline Window getGroupWindow(void) const { return client.window_group; }
- inline Windowmenu * getWindowmenu(void) const { return windowmenu; }
-
inline const char *getTitle(void) const
{ return client.title.c_str(); }
inline const char *getIconTitle(void) const
using std::string;
#include "blackbox.hh"
-#include "clientmenu.hh"
#include "font.hh"
-#include "netizen.hh"
#include "screen.hh"
-#include "toolbar.hh"
#include "util.hh"
#include "window.hh"
#include "workspace.hh"
-#include "windowmenu.hh"
#include "xatom.hh"
id = i;
- clientmenu = new Clientmenu(this);
-
lastfocus = (BlackboxWindow *) 0;
readName();
windowList.push_back(w);
- clientmenu->insert(w->getTitle());
- clientmenu->update();
-
- if (! sticky)
- screen->updateNetizenWindowAdd(w->getClientWindow(), id);
-
if (screen->doFocusNew() || (w->isTransient() && w->getTransientFor() &&
w->getTransientFor()->isFocused())) {
if (id != screen->getCurrentWorkspaceID()) {
assert(it != end);
windowList.erase(it);
- clientmenu->remove(i);
- clientmenu->update();
-
if (! sticky) {
- screen->updateNetizenWindowDel(w->getClientWindow());
-
BlackboxWindowList::iterator it = windowList.begin();
const BlackboxWindowList::iterator end = windowList.end();
unsigned int i = 0;
}
-void Workspace::setFocused(const BlackboxWindow *w, bool focused) {
- BlackboxWindowList::iterator it, end = windowList.end();
- int i;
- for (i = 0, it = windowList.begin(); it != end; ++it, ++i)
- if (*it == w)
- break;
- // if its == end, then a window thats not in the windowList
- // got focused, such as a !isNormal() window.
- if (it != end)
- clientmenu->setItemSelected(i, focused);
-}
-
-
void Workspace::removeAll(void) {
while (! windowList.empty())
windowList.front()->iconify();
for (it = win->getTransients().begin(); it != end; ++it) {
BlackboxWindow *w = *it;
*stack++ = w->getFrameWindow();
- screen->updateNetizenWindowRaise(w->getClientWindow());
if (! w->isIconic()) {
Workspace *wkspc = screen->getWorkspace(w->getWorkspaceNumber());
for (it = win->getTransients().rbegin(); it != end; ++it) {
BlackboxWindow *w = *it;
*stack++ = w->getFrameWindow();
- screen->updateNetizenWindowLower(w->getClientWindow());
if (! w->isIconic()) {
Workspace *wkspc = screen->getWorkspace(w->getWorkspaceNumber());
StackVector::iterator stack = stack_vector.begin();
*(stack++) = win->getFrameWindow();
- screen->updateNetizenWindowRaise(win->getClientWindow());
if (! (win->isIconic() || win->isDesktop())) {
Workspace *wkspc = screen->getWorkspace(win->getWorkspaceNumber());
wkspc->stackingList.remove(win);
lowerTransients(win, stack);
*(stack++) = win->getFrameWindow();
- screen->updateNetizenWindowLower(win->getClientWindow());
if (! (win->isIconic() || win->isDesktop())) {
Workspace *wkspc = screen->getWorkspace(win->getWorkspaceNumber());
wkspc->stackingList.remove(win);
void Workspace::reconfigure(void) {
- clientmenu->reconfigure();
std::for_each(windowList.begin(), windowList.end(),
std::mem_fun(&BlackboxWindow::reconfigure));
}
}
-void Workspace::sendWindowList(Netizen &n) {
- BlackboxWindowList::iterator it = windowList.begin(),
- end = windowList.end();
- for(; it != end; ++it)
- n.sendWindowAdd((*it)->getClientWindow(), getID());
-}
-
-
unsigned int Workspace::getCount(void) const {
return windowList.size();
}
namesList.size() > id) {
name = namesList[id];
- clientmenu->setLabel(name);
- clientmenu->update();
} else {
/*
Use a default name. This doesn't actually change the class. That will
happen after the setName changes the root property, and that change
makes its way back to this function.
*/
- string tmp =i18n(WorkspaceSet, WorkspaceDefaultNameFormat,
- "Workspace %d");
+ string tmp = "Workspace %d";
assert(tmp.length() < 32);
char default_name[32];
sprintf(default_name, tmp.c_str(), id + 1);
#include <string>
#include <vector>
+#include "xatom.hh"
+
class BScreen;
-class Clientmenu;
class Workspace;
class BlackboxWindow;
-class Netizen;
typedef std::list<BlackboxWindow*> BlackboxWindowList;
typedef std::vector<Window> StackVector;
private:
BScreen *screen;
BlackboxWindow *lastfocus;
- Clientmenu *clientmenu;
XAtom *xatom;
BlackboxWindowList stackingList, windowList;
inline BlackboxWindow *getLastFocusedWindow(void) { return lastfocus; }
- inline Clientmenu *getMenu(void) { return clientmenu; }
-
inline const std::string& getName(void) const { return name; }
inline unsigned int getID(void) const { return id; }
BlackboxWindow* getNextWindowInList(BlackboxWindow *w);
BlackboxWindow* getPrevWindowInList(BlackboxWindow *w);
BlackboxWindow* getTopWindowOnStack(void) const;
- void sendWindowList(Netizen &n);
void focusFallback(const BlackboxWindow *old_window);
- void setFocused(const BlackboxWindow *w, bool focused);
bool isCurrent(void) const;
bool isLastWindow(const BlackboxWindow* w) const;