compiles now. uses xft2
remove the nls remainders
This commit is contained in:
parent
0caf2ba931
commit
7bf96a9123
43 changed files with 136 additions and 2188 deletions
|
@ -1,6 +1,6 @@
|
||||||
# Makefile.am for Openbox
|
# 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
|
MAINTAINERCLEANFILES = aclocal.m4 config.h.in configure Makefile.in stamp-h.in
|
||||||
|
|
||||||
uninstall-local:
|
uninstall-local:
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
blackbox-nls.hh
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
|
@ -1,2 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
|
@ -1,4 +0,0 @@
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
Translation.m
|
|
||||||
openbox.cat
|
|
132
src/Makefile.am
132
src/Makefile.am
|
@ -1,35 +1,16 @@
|
||||||
# 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_MENU=$(pkgdatadir)/menu
|
||||||
DEFAULT_STYLE=$(pkgdatadir)/styles/mbdtex
|
DEFAULT_STYLE=$(pkgdatadir)/styles/mbdtex
|
||||||
|
|
||||||
CPPFLAGS=@CPPFLAGS@ @DEBUG@ \
|
CXXFLAGS=`pkg-config --cflags xft` @CXXFLAGS@ \
|
||||||
-DLOCALEPATH=\"$(pkgdatadir)/nls\" \
|
|
||||||
-DDEFAULTMENU=\"$(DEFAULT_MENU)\" \
|
-DDEFAULTMENU=\"$(DEFAULT_MENU)\" \
|
||||||
-DDEFAULTSTYLE=\"$(DEFAULT_STYLE)\"
|
-DDEFAULTSTYLE=\"$(DEFAULT_STYLE)\" \
|
||||||
|
-Dmultibyte\(\)=True
|
||||||
|
|
||||||
|
LDFLAGS=`pkg-config --libs xft`
|
||||||
|
|
||||||
bin_PROGRAMS= openbox
|
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
|
MAINTAINERCLEANFILES= Makefile.in
|
||||||
|
|
||||||
|
@ -37,104 +18,3 @@ distclean-local:
|
||||||
rm -f *\~ *.orig *.rej .\#*
|
rm -f *\~ *.orig *.rej .\#*
|
||||||
|
|
||||||
# local dependencies
|
# 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
|
|
||||||
|
|
|
@ -1,25 +1,4 @@
|
||||||
// -*- mode: C++; indent-tabs-mode: nil; -*-
|
// -*- 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
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "../config.h"
|
# include "../config.h"
|
||||||
|
@ -102,9 +81,7 @@ static int handleXErrors(Display *d, XErrorEvent *e) {
|
||||||
char errtxt[128];
|
char errtxt[128];
|
||||||
|
|
||||||
XGetErrorText(d, e->error_code, errtxt, 128);
|
XGetErrorText(d, e->error_code, errtxt, 128);
|
||||||
fprintf(stderr,
|
fprintf(stderr, "%s: X error: %s(%d) opcodes %d/%d\n resource 0x%lx\n",
|
||||||
i18n(BaseDisplaySet, BaseDisplayXError,
|
|
||||||
"%s: X error: %s(%d) opcodes %d/%d\n resource 0x%lx\n"),
|
|
||||||
base_display->getApplicationName(), errtxt, e->error_code,
|
base_display->getApplicationName(), errtxt, e->error_code,
|
||||||
e->request_code, e->minor_code, e->resourceid);
|
e->request_code, e->minor_code, e->resourceid);
|
||||||
#else
|
#else
|
||||||
|
@ -121,11 +98,7 @@ static int handleXErrors(Display *d, XErrorEvent *e) {
|
||||||
|
|
||||||
// signal handler to allow for proper and gentle shutdown
|
// signal handler to allow for proper and gentle shutdown
|
||||||
|
|
||||||
#ifndef HAVE_SIGACTION
|
|
||||||
static RETSIGTYPE signalhandler(int sig) {
|
|
||||||
#else // HAVE_SIGACTION
|
|
||||||
static void signalhandler(int sig) {
|
static void signalhandler(int sig) {
|
||||||
#endif // HAVE_SIGACTION
|
|
||||||
|
|
||||||
static int re_enter = 0;
|
static int re_enter = 0;
|
||||||
|
|
||||||
|
@ -133,41 +106,25 @@ static void signalhandler(int sig) {
|
||||||
case SIGCHLD:
|
case SIGCHLD:
|
||||||
int status;
|
int status;
|
||||||
waitpid(-1, &status, WNOHANG | WUNTRACED);
|
waitpid(-1, &status, WNOHANG | WUNTRACED);
|
||||||
|
|
||||||
#ifndef HAVE_SIGACTION
|
|
||||||
// assume broken, braindead sysv signal semantics
|
|
||||||
signal(SIGCHLD, (RETSIGTYPE (*)(int)) signalhandler);
|
|
||||||
#endif // HAVE_SIGACTION
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (base_display->handleSignal(sig)) {
|
if (base_display->handleSignal(sig))
|
||||||
|
|
||||||
#ifndef HAVE_SIGACTION
|
|
||||||
// assume broken, braindead sysv signal semantics
|
|
||||||
signal(sig, (RETSIGTYPE (*)(int)) signalhandler);
|
|
||||||
#endif // HAVE_SIGACTION
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(stderr, i18n(BaseDisplaySet, BaseDisplaySignalCaught,
|
fprintf(stderr, "%s: signal %d caught\n",
|
||||||
"%s: signal %d caught\n"),
|
|
||||||
base_display->getApplicationName(), sig);
|
base_display->getApplicationName(), sig);
|
||||||
|
|
||||||
if (! base_display->isStartup() && ! re_enter) {
|
if (! base_display->isStartup() && ! re_enter) {
|
||||||
internal_error = True;
|
internal_error = True;
|
||||||
|
|
||||||
re_enter = 1;
|
re_enter = 1;
|
||||||
fprintf(stderr, i18n(BaseDisplaySet, BaseDisplayShuttingDown,
|
fprintf(stderr, "shutting down\n");
|
||||||
"shutting down\n"));
|
|
||||||
base_display->shutdown();
|
base_display->shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sig != SIGTERM && sig != SIGINT) {
|
if (sig != SIGTERM && sig != SIGINT) {
|
||||||
fprintf(stderr, i18n(BaseDisplaySet, BaseDisplayAborting,
|
fprintf(stderr, "aborting... dumping core\n");
|
||||||
"aborting... dumping core\n"));
|
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +142,6 @@ BaseDisplay::BaseDisplay(const char *app_name, const char *dpy_name) {
|
||||||
|
|
||||||
::base_display = this;
|
::base_display = this;
|
||||||
|
|
||||||
#ifdef HAVE_SIGACTION
|
|
||||||
struct sigaction action;
|
struct sigaction action;
|
||||||
|
|
||||||
action.sa_handler = signalhandler;
|
action.sa_handler = signalhandler;
|
||||||
|
@ -201,28 +157,15 @@ BaseDisplay::BaseDisplay(const char *app_name, const char *dpy_name) {
|
||||||
sigaction(SIGHUP, &action, NULL);
|
sigaction(SIGHUP, &action, NULL);
|
||||||
sigaction(SIGUSR1, &action, NULL);
|
sigaction(SIGUSR1, &action, NULL);
|
||||||
sigaction(SIGUSR2, &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))) {
|
if (! (display = XOpenDisplay(dpy_name))) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
i18n(BaseDisplaySet, BaseDisplayXConnectFail,
|
"BaseDisplay::BaseDisplay: connection to X server failed.\n");
|
||||||
"BaseDisplay::BaseDisplay: connection to X server failed.\n"));
|
|
||||||
::exit(2);
|
::exit(2);
|
||||||
} else if (fcntl(ConnectionNumber(display), F_SETFD, 1) == -1) {
|
} else if (fcntl(ConnectionNumber(display), F_SETFD, 1) == -1) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
i18n(BaseDisplaySet, BaseDisplayCloseOnExecFail,
|
"BaseDisplay::BaseDisplay: couldn't mark display connection "
|
||||||
"BaseDisplay::BaseDisplay: couldn't mark display connection "
|
"as close-on-exec\n");
|
||||||
"as close-on-exec\n"));
|
|
||||||
::exit(2);
|
::exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
242
src/blackbox.cc
242
src/blackbox.cc
|
@ -97,24 +97,18 @@ extern "C" {
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
#include "blackbox.hh"
|
#include "blackbox.hh"
|
||||||
#include "basemenu.hh"
|
|
||||||
#include "clientmenu.hh"
|
|
||||||
#include "gccache.hh"
|
#include "gccache.hh"
|
||||||
#include "image.hh"
|
#include "image.hh"
|
||||||
#include "rootmenu.hh"
|
|
||||||
#include "screen.hh"
|
#include "screen.hh"
|
||||||
#include "slit.hh"
|
|
||||||
#include "toolbar.hh"
|
|
||||||
#include "util.hh"
|
#include "util.hh"
|
||||||
#include "window.hh"
|
#include "window.hh"
|
||||||
#include "workspace.hh"
|
#include "workspace.hh"
|
||||||
#include "workspacemenu.hh"
|
|
||||||
#include "xatom.hh"
|
#include "xatom.hh"
|
||||||
|
|
||||||
Blackbox *blackbox;
|
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) {
|
: BaseDisplay(m_argv[0], dpy_name) {
|
||||||
if (! XSupportsLocale())
|
if (! XSupportsLocale())
|
||||||
fprintf(stderr, "X server does not support locale\n");
|
fprintf(stderr, "X server does not support locale\n");
|
||||||
|
@ -134,17 +128,6 @@ Blackbox::Blackbox(char **m_argv, char *dpy_name, char *rc, char *menu)
|
||||||
rc_file = expandTilde(rc);
|
rc_file = expandTilde(rc);
|
||||||
config.setFile(rc_file);
|
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;
|
no_focus = False;
|
||||||
|
|
||||||
resource.auto_raise_delay.tv_sec = resource.auto_raise_delay.tv_usec = 0;
|
resource.auto_raise_delay.tv_sec = resource.auto_raise_delay.tv_usec = 0;
|
||||||
|
@ -176,8 +159,7 @@ Blackbox::Blackbox(char **m_argv, char *dpy_name, char *rc, char *menu)
|
||||||
|
|
||||||
if (screenList.empty()) {
|
if (screenList.empty()) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
i18n(blackboxSet, blackboxNoManagableScreens,
|
"Blackbox::Blackbox: no managable screens found, aborting.\n");
|
||||||
"Blackbox::Blackbox: no managable screens found, aborting.\n"));
|
|
||||||
::exit(3);
|
::exit(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +173,7 @@ Blackbox::Blackbox(char **m_argv, char *dpy_name, char *rc, char *menu)
|
||||||
XSynchronize(getXDisplay(), False);
|
XSynchronize(getXDisplay(), False);
|
||||||
XSync(getXDisplay(), False);
|
XSync(getXDisplay(), False);
|
||||||
|
|
||||||
reconfigure_wait = reread_menu_wait = False;
|
reconfigure_wait = False;
|
||||||
|
|
||||||
timer = new BTimer(this, this);
|
timer = new BTimer(this, this);
|
||||||
timer->setTimeout(0l);
|
timer->setTimeout(0l);
|
||||||
|
@ -201,9 +183,6 @@ Blackbox::Blackbox(char **m_argv, char *dpy_name, char *rc, char *menu)
|
||||||
Blackbox::~Blackbox(void) {
|
Blackbox::~Blackbox(void) {
|
||||||
std::for_each(screenList.begin(), screenList.end(), PointerAssassin());
|
std::for_each(screenList.begin(), screenList.end(), PointerAssassin());
|
||||||
|
|
||||||
std::for_each(menuTimestamps.begin(), menuTimestamps.end(),
|
|
||||||
PointerAssassin());
|
|
||||||
|
|
||||||
delete xatom;
|
delete xatom;
|
||||||
|
|
||||||
delete timer;
|
delete timer;
|
||||||
|
@ -219,9 +198,6 @@ void Blackbox::process_event(XEvent *e) {
|
||||||
last_time = e->xbutton.time;
|
last_time = e->xbutton.time;
|
||||||
|
|
||||||
BlackboxWindow *win = (BlackboxWindow *) 0;
|
BlackboxWindow *win = (BlackboxWindow *) 0;
|
||||||
Basemenu *menu = (Basemenu *) 0;
|
|
||||||
Slit *slit = (Slit *) 0;
|
|
||||||
Toolbar *tbar = (Toolbar *) 0;
|
|
||||||
BScreen *scrn = (BScreen *) 0;
|
BScreen *scrn = (BScreen *) 0;
|
||||||
|
|
||||||
if ((win = searchWindow(e->xbutton.window))) {
|
if ((win = searchWindow(e->xbutton.window))) {
|
||||||
|
@ -230,12 +206,6 @@ void Blackbox::process_event(XEvent *e) {
|
||||||
/* XXX: is this sane on low colour desktops? */
|
/* XXX: is this sane on low colour desktops? */
|
||||||
if (e->xbutton.button == 1)
|
if (e->xbutton.button == 1)
|
||||||
win->installColormap(True);
|
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))) {
|
} else if ((scrn = searchScreen(e->xbutton.window))) {
|
||||||
scrn->buttonPressEvent(&e->xbutton);
|
scrn->buttonPressEvent(&e->xbutton);
|
||||||
if (active_screen != scrn) {
|
if (active_screen != scrn) {
|
||||||
|
@ -256,27 +226,18 @@ void Blackbox::process_event(XEvent *e) {
|
||||||
last_time = e->xbutton.time;
|
last_time = e->xbutton.time;
|
||||||
|
|
||||||
BlackboxWindow *win = (BlackboxWindow *) 0;
|
BlackboxWindow *win = (BlackboxWindow *) 0;
|
||||||
Basemenu *menu = (Basemenu *) 0;
|
|
||||||
Toolbar *tbar = (Toolbar *) 0;
|
|
||||||
|
|
||||||
if ((win = searchWindow(e->xbutton.window)))
|
if ((win = searchWindow(e->xbutton.window)))
|
||||||
win->buttonReleaseEvent(&e->xbutton);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case ConfigureRequest: {
|
case ConfigureRequest: {
|
||||||
BlackboxWindow *win = (BlackboxWindow *) 0;
|
BlackboxWindow *win = (BlackboxWindow *) 0;
|
||||||
Slit *slit = (Slit *) 0;
|
|
||||||
|
|
||||||
if ((win = searchWindow(e->xconfigurerequest.window))) {
|
if ((win = searchWindow(e->xconfigurerequest.window))) {
|
||||||
win->configureRequestEvent(&e->xconfigurerequest);
|
win->configureRequestEvent(&e->xconfigurerequest);
|
||||||
} else if ((slit = searchSlit(e->xconfigurerequest.window))) {
|
|
||||||
slit->configureRequestEvent(&e->xconfigurerequest);
|
|
||||||
} else {
|
} else {
|
||||||
if (validateWindow(e->xconfigurerequest.window)) {
|
if (validateWindow(e->xconfigurerequest.window)) {
|
||||||
XWindowChanges xwc;
|
XWindowChanges xwc;
|
||||||
|
@ -354,13 +315,10 @@ void Blackbox::process_event(XEvent *e) {
|
||||||
|
|
||||||
case UnmapNotify: {
|
case UnmapNotify: {
|
||||||
BlackboxWindow *win = (BlackboxWindow *) 0;
|
BlackboxWindow *win = (BlackboxWindow *) 0;
|
||||||
Slit *slit = (Slit *) 0;
|
|
||||||
BScreen *screen = (BScreen *) 0;
|
BScreen *screen = (BScreen *) 0;
|
||||||
|
|
||||||
if ((win = searchWindow(e->xunmap.window))) {
|
if ((win = searchWindow(e->xunmap.window))) {
|
||||||
win->unmapNotifyEvent(&e->xunmap);
|
win->unmapNotifyEvent(&e->xunmap);
|
||||||
} else if ((slit = searchSlit(e->xunmap.window))) {
|
|
||||||
slit->unmapNotifyEvent(&e->xunmap);
|
|
||||||
} else if ((screen = searchSystrayWindow(e->xunmap.window))) {
|
} else if ((screen = searchSystrayWindow(e->xunmap.window))) {
|
||||||
screen->removeSystrayWindow(e->xunmap.window);
|
screen->removeSystrayWindow(e->xunmap.window);
|
||||||
}
|
}
|
||||||
|
@ -370,14 +328,11 @@ void Blackbox::process_event(XEvent *e) {
|
||||||
|
|
||||||
case DestroyNotify: {
|
case DestroyNotify: {
|
||||||
BlackboxWindow *win = (BlackboxWindow *) 0;
|
BlackboxWindow *win = (BlackboxWindow *) 0;
|
||||||
Slit *slit = (Slit *) 0;
|
|
||||||
BScreen *screen = (BScreen *) 0;
|
BScreen *screen = (BScreen *) 0;
|
||||||
BWindowGroup *group = (BWindowGroup *) 0;
|
BWindowGroup *group = (BWindowGroup *) 0;
|
||||||
|
|
||||||
if ((win = searchWindow(e->xdestroywindow.window))) {
|
if ((win = searchWindow(e->xdestroywindow.window))) {
|
||||||
win->destroyNotifyEvent(&e->xdestroywindow);
|
win->destroyNotifyEvent(&e->xdestroywindow);
|
||||||
} else if ((slit = searchSlit(e->xdestroywindow.window))) {
|
|
||||||
slit->removeClient(e->xdestroywindow.window, False);
|
|
||||||
} else if ((group = searchGroup(e->xdestroywindow.window))) {
|
} else if ((group = searchGroup(e->xdestroywindow.window))) {
|
||||||
delete group;
|
delete group;
|
||||||
} else if ((screen = searchSystrayWindow(e->xunmap.window))) {
|
} else if ((screen = searchSystrayWindow(e->xunmap.window))) {
|
||||||
|
@ -395,13 +350,8 @@ void Blackbox::process_event(XEvent *e) {
|
||||||
to an already unmapped window.
|
to an already unmapped window.
|
||||||
*/
|
*/
|
||||||
BlackboxWindow *win = searchWindow(e->xreparent.window);
|
BlackboxWindow *win = searchWindow(e->xreparent.window);
|
||||||
if (win) {
|
if (win)
|
||||||
win->reparentNotifyEvent(&e->xreparent);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,12 +378,9 @@ void Blackbox::process_event(XEvent *e) {
|
||||||
last_time = e->xmotion.time;
|
last_time = e->xmotion.time;
|
||||||
|
|
||||||
BlackboxWindow *win = (BlackboxWindow *) 0;
|
BlackboxWindow *win = (BlackboxWindow *) 0;
|
||||||
Basemenu *menu = (Basemenu *) 0;
|
|
||||||
|
|
||||||
if ((win = searchWindow(e->xmotion.window)))
|
if ((win = searchWindow(e->xmotion.window)))
|
||||||
win->motionNotifyEvent(&e->xmotion);
|
win->motionNotifyEvent(&e->xmotion);
|
||||||
else if ((menu = searchMenu(e->xmotion.window)))
|
|
||||||
menu->motionNotifyEvent(&e->xmotion);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -456,9 +403,6 @@ void Blackbox::process_event(XEvent *e) {
|
||||||
|
|
||||||
BScreen *screen = (BScreen *) 0;
|
BScreen *screen = (BScreen *) 0;
|
||||||
BlackboxWindow *win = (BlackboxWindow *) 0;
|
BlackboxWindow *win = (BlackboxWindow *) 0;
|
||||||
Basemenu *menu = (Basemenu *) 0;
|
|
||||||
Toolbar *tbar = (Toolbar *) 0;
|
|
||||||
Slit *slit = (Slit *) 0;
|
|
||||||
|
|
||||||
if (e->xcrossing.mode == NotifyGrab) break;
|
if (e->xcrossing.mode == NotifyGrab) break;
|
||||||
|
|
||||||
|
@ -468,12 +412,6 @@ void Blackbox::process_event(XEvent *e) {
|
||||||
} else if ((win = searchWindow(e->xcrossing.window))) {
|
} else if ((win = searchWindow(e->xcrossing.window))) {
|
||||||
if (! no_focus)
|
if (! no_focus)
|
||||||
win->enterNotifyEvent(&e->xcrossing);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -482,18 +420,9 @@ void Blackbox::process_event(XEvent *e) {
|
||||||
last_time = e->xcrossing.time;
|
last_time = e->xcrossing.time;
|
||||||
|
|
||||||
BlackboxWindow *win = (BlackboxWindow *) 0;
|
BlackboxWindow *win = (BlackboxWindow *) 0;
|
||||||
Basemenu *menu = (Basemenu *) 0;
|
|
||||||
Toolbar *tbar = (Toolbar *) 0;
|
|
||||||
Slit *slit = (Slit *) 0;
|
|
||||||
|
|
||||||
if ((menu = searchMenu(e->xcrossing.window)))
|
if ((win = searchWindow(e->xcrossing.window)))
|
||||||
menu->leaveNotifyEvent(&e->xcrossing);
|
|
||||||
else if ((win = searchWindow(e->xcrossing.window)))
|
|
||||||
win->leaveNotifyEvent(&e->xcrossing);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -526,25 +455,14 @@ void Blackbox::process_event(XEvent *e) {
|
||||||
e->xexpose.height = ey2 - ey1 + 1;
|
e->xexpose.height = ey2 - ey1 + 1;
|
||||||
|
|
||||||
BlackboxWindow *win = (BlackboxWindow *) 0;
|
BlackboxWindow *win = (BlackboxWindow *) 0;
|
||||||
Basemenu *menu = (Basemenu *) 0;
|
|
||||||
Toolbar *tbar = (Toolbar *) 0;
|
|
||||||
|
|
||||||
if ((win = searchWindow(e->xexpose.window)))
|
if ((win = searchWindow(e->xexpose.window)))
|
||||||
win->exposeEvent(&e->xexpose);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case KeyPress: {
|
case KeyPress: {
|
||||||
Toolbar *tbar = searchToolbar(e->xkey.window);
|
|
||||||
|
|
||||||
if (tbar && tbar->isEditing())
|
|
||||||
tbar->keyPressEvent(&e->xkey);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -916,28 +834,6 @@ void Blackbox::process_event(XEvent *e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -975,7 +871,6 @@ bool Blackbox::handleSignal(int sig) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIGUSR2:
|
case SIGUSR2:
|
||||||
rereadMenu();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIGPIPE:
|
case SIGPIPE:
|
||||||
|
@ -1045,33 +940,6 @@ BWindowGroup *Blackbox::searchGroup(Window window) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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) {
|
void Blackbox::saveSystrayWindowSearch(Window window, BScreen *screen) {
|
||||||
systraySearchList.insert(WindowScreenLookupPair(window, screen));
|
systraySearchList.insert(WindowScreenLookupPair(window, screen));
|
||||||
}
|
}
|
||||||
|
@ -1087,21 +955,6 @@ void Blackbox::saveGroupSearch(Window window, BWindowGroup *data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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) {
|
void Blackbox::removeSystrayWindowSearch(Window window) {
|
||||||
systraySearchList.erase(window);
|
systraySearchList.erase(window);
|
||||||
}
|
}
|
||||||
|
@ -1117,21 +970,6 @@ void Blackbox::removeGroupSearch(Window 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) {
|
void Blackbox::restart(const char *prog) {
|
||||||
shutdown();
|
shutdown();
|
||||||
|
|
||||||
|
@ -1318,10 +1156,6 @@ void Blackbox::reconfigure(void) {
|
||||||
void Blackbox::real_reconfigure(void) {
|
void Blackbox::real_reconfigure(void) {
|
||||||
load_rc();
|
load_rc();
|
||||||
|
|
||||||
std::for_each(menuTimestamps.begin(), menuTimestamps.end(),
|
|
||||||
PointerAssassin());
|
|
||||||
menuTimestamps.clear();
|
|
||||||
|
|
||||||
gcCache()->purge();
|
gcCache()->purge();
|
||||||
|
|
||||||
std::for_each(screenList.begin(), screenList.end(),
|
std::for_each(screenList.begin(), screenList.end(),
|
||||||
|
@ -1329,42 +1163,6 @@ void Blackbox::real_reconfigure(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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) {
|
void Blackbox::saveStyleFilename(const string& filename) {
|
||||||
assert(! filename.empty());
|
assert(! filename.empty());
|
||||||
resource.style_file = filename;
|
resource.style_file = filename;
|
||||||
|
@ -1372,37 +1170,11 @@ void Blackbox::saveStyleFilename(const string& 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) {
|
void Blackbox::timeout(void) {
|
||||||
if (reconfigure_wait)
|
if (reconfigure_wait)
|
||||||
real_reconfigure();
|
real_reconfigure();
|
||||||
|
|
||||||
if (reread_menu_wait)
|
reconfigure_wait = False;
|
||||||
real_rereadMenu();
|
|
||||||
|
|
||||||
reconfigure_wait = reread_menu_wait = False;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1453,12 +1225,10 @@ void Blackbox::setFocusedWindow(BlackboxWindow *win) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (active_screen && active_screen->isScreenManaged()) {
|
if (active_screen && active_screen->isScreenManaged()) {
|
||||||
active_screen->getToolbar()->redrawWindowLabel(True);
|
|
||||||
active_screen->updateNetizenWindowFocus();
|
active_screen->updateNetizenWindowFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old_screen && old_screen != active_screen) {
|
if (old_screen && old_screen != active_screen) {
|
||||||
old_screen->getToolbar()->redrawWindowLabel(True);
|
|
||||||
old_screen->updateNetizenWindowFocus();
|
old_screen->updateNetizenWindowFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,11 +88,6 @@ class BScreen;
|
||||||
class Blackbox;
|
class Blackbox;
|
||||||
class BlackboxWindow;
|
class BlackboxWindow;
|
||||||
class BWindowGroup;
|
class BWindowGroup;
|
||||||
class Basemenu;
|
|
||||||
class Toolbar;
|
|
||||||
class Slit;
|
|
||||||
|
|
||||||
extern I18n i18n;
|
|
||||||
|
|
||||||
class Blackbox : public BaseDisplay, public TimeoutHandler {
|
class Blackbox : public BaseDisplay, public TimeoutHandler {
|
||||||
private:
|
private:
|
||||||
|
@ -101,11 +96,6 @@ private:
|
||||||
};
|
};
|
||||||
BCursor cursor;
|
BCursor cursor;
|
||||||
|
|
||||||
struct MenuTimestamp {
|
|
||||||
std::string filename;
|
|
||||||
time_t timestamp;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct BResource {
|
struct BResource {
|
||||||
Time double_click_interval;
|
Time double_click_interval;
|
||||||
|
|
||||||
|
@ -134,21 +124,6 @@ private:
|
||||||
typedef GroupLookup::value_type GroupLookupPair;
|
typedef GroupLookup::value_type GroupLookupPair;
|
||||||
GroupLookup groupSearchList;
|
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;
|
typedef std::list<BScreen*> ScreenList;
|
||||||
ScreenList screenList;
|
ScreenList screenList;
|
||||||
|
|
||||||
|
@ -158,33 +133,29 @@ private:
|
||||||
Configuration config;
|
Configuration config;
|
||||||
XAtom *xatom;
|
XAtom *xatom;
|
||||||
|
|
||||||
bool no_focus, reconfigure_wait, reread_menu_wait;
|
bool no_focus, reconfigure_wait;
|
||||||
Time last_time;
|
Time last_time;
|
||||||
char **argv;
|
char **argv;
|
||||||
std::string menu_file, rc_file;
|
std::string rc_file;
|
||||||
|
|
||||||
Blackbox(const Blackbox&);
|
Blackbox(const Blackbox&);
|
||||||
Blackbox& operator=(const Blackbox&);
|
Blackbox& operator=(const Blackbox&);
|
||||||
|
|
||||||
void load_rc(void);
|
void load_rc(void);
|
||||||
void save_rc(void);
|
void save_rc(void);
|
||||||
void real_rereadMenu(void);
|
|
||||||
void real_reconfigure(void);
|
void real_reconfigure(void);
|
||||||
|
|
||||||
virtual void process_event(XEvent *);
|
virtual void process_event(XEvent *);
|
||||||
|
|
||||||
|
|
||||||
public:
|
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);
|
virtual ~Blackbox(void);
|
||||||
|
|
||||||
Basemenu *searchMenu(Window window);
|
|
||||||
BWindowGroup *searchGroup(Window window);
|
BWindowGroup *searchGroup(Window window);
|
||||||
BScreen *searchSystrayWindow(Window window);
|
BScreen *searchSystrayWindow(Window window);
|
||||||
BlackboxWindow *searchWindow(Window window);
|
BlackboxWindow *searchWindow(Window window);
|
||||||
BScreen *searchScreen(Window window);
|
BScreen *searchScreen(Window window);
|
||||||
Toolbar *searchToolbar(Window);
|
|
||||||
Slit *searchSlit(Window);
|
|
||||||
|
|
||||||
#ifdef XINERAMA
|
#ifdef XINERAMA
|
||||||
inline bool doXineramaPlacement(void) const
|
inline bool doXineramaPlacement(void) const
|
||||||
|
@ -199,18 +170,12 @@ public:
|
||||||
void saveXineramaSnapping(bool x);
|
void saveXineramaSnapping(bool x);
|
||||||
#endif // XINERAMA
|
#endif // XINERAMA
|
||||||
|
|
||||||
void saveMenuSearch(Window window, Basemenu *data);
|
|
||||||
void saveSystrayWindowSearch(Window window, BScreen *screen);
|
void saveSystrayWindowSearch(Window window, BScreen *screen);
|
||||||
void saveWindowSearch(Window window, BlackboxWindow *data);
|
void saveWindowSearch(Window window, BlackboxWindow *data);
|
||||||
void saveGroupSearch(Window window, BWindowGroup *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 removeSystrayWindowSearch(Window window);
|
||||||
void removeWindowSearch(Window window);
|
void removeWindowSearch(Window window);
|
||||||
void removeGroupSearch(Window window);
|
void removeGroupSearch(Window window);
|
||||||
void removeToolbarSearch(Window window);
|
|
||||||
void removeSlitSearch(Window window);
|
|
||||||
|
|
||||||
inline XAtom *getXAtom(void) { return xatom; }
|
inline XAtom *getXAtom(void) { return xatom; }
|
||||||
|
|
||||||
|
@ -224,8 +189,6 @@ public:
|
||||||
|
|
||||||
inline const char *getStyleFilename(void) const
|
inline const char *getStyleFilename(void) const
|
||||||
{ return resource.style_file.c_str(); }
|
{ return resource.style_file.c_str(); }
|
||||||
inline const char *getMenuFilename(void) const
|
|
||||||
{ return menu_file.c_str(); }
|
|
||||||
|
|
||||||
inline int getColorsPerChannel(void) const
|
inline int getColorsPerChannel(void) const
|
||||||
{ return resource.colors_per_channel; }
|
{ return resource.colors_per_channel; }
|
||||||
|
@ -263,11 +226,8 @@ public:
|
||||||
void setChangingWindow(BlackboxWindow *win);
|
void setChangingWindow(BlackboxWindow *win);
|
||||||
void shutdown(void);
|
void shutdown(void);
|
||||||
void saveStyleFilename(const std::string& filename);
|
void saveStyleFilename(const std::string& filename);
|
||||||
void addMenuTimestamp(const std::string& filename);
|
|
||||||
void restart(const char *prog = 0);
|
void restart(const char *prog = 0);
|
||||||
void reconfigure(void);
|
void reconfigure(void);
|
||||||
void rereadMenu(void);
|
|
||||||
void checkMenu(void);
|
|
||||||
|
|
||||||
bool validateWindow(Window window);
|
bool validateWindow(Window window);
|
||||||
|
|
||||||
|
@ -275,9 +235,7 @@ public:
|
||||||
|
|
||||||
virtual void timeout(void);
|
virtual void timeout(void);
|
||||||
|
|
||||||
#ifndef HAVE_STRFTIME
|
|
||||||
enum { B_AmericanDate = 1, B_EuropeanDate };
|
enum { B_AmericanDate = 1, B_EuropeanDate };
|
||||||
#endif // HAVE_STRFTIME
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
287
src/font.cc
287
src/font.cc
|
@ -45,7 +45,6 @@ using std::endl;
|
||||||
|
|
||||||
string BFont::_fallback_font = "fixed";
|
string BFont::_fallback_font = "fixed";
|
||||||
|
|
||||||
#ifdef XFT
|
|
||||||
BFont::BFont(Display *d, BScreen *screen, const string &family, int size,
|
BFont::BFont(Display *d, BScreen *screen, const string &family, int size,
|
||||||
bool bold, bool italic, bool shadow, unsigned char offset,
|
bool bold, bool italic, bool shadow, unsigned char offset,
|
||||||
unsigned char tint, bool antialias) :
|
unsigned char tint, bool antialias) :
|
||||||
|
@ -60,10 +59,7 @@ BFont::BFont(Display *d, BScreen *screen, const string &family, int size,
|
||||||
_shadow(shadow),
|
_shadow(shadow),
|
||||||
_offset(offset),
|
_offset(offset),
|
||||||
_tint(tint),
|
_tint(tint),
|
||||||
_xftfont(0),
|
_xftfont(0) {
|
||||||
_font(0),
|
|
||||||
_fontset(0),
|
|
||||||
_fontset_extents(0) {
|
|
||||||
_valid = False;
|
_valid = False;
|
||||||
|
|
||||||
_xftfont = XftFontOpen(_display, _screen->getScreenNumber(),
|
_xftfont = XftFontOpen(_display, _screen->getScreenNumber(),
|
||||||
|
@ -80,177 +76,13 @@ BFont::BFont(Display *d, BScreen *screen, const string &family, int size,
|
||||||
if (! _xftfont)
|
if (! _xftfont)
|
||||||
return; // failure
|
return; // failure
|
||||||
|
|
||||||
_font = XLoadQueryFont(_display, buildXlfd().c_str());
|
|
||||||
if (! _font)
|
|
||||||
return; // failure
|
|
||||||
|
|
||||||
_valid = True;
|
_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) {
|
BFont::~BFont(void) {
|
||||||
#ifdef XFT
|
|
||||||
if (_xftfont)
|
if (_xftfont)
|
||||||
XftFontClose(_display, _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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -258,117 +90,60 @@ void BFont::drawString(Drawable d, int x, int y, const BColor &color,
|
||||||
const string &string) const {
|
const string &string) const {
|
||||||
assert(_valid);
|
assert(_valid);
|
||||||
|
|
||||||
#ifdef XFT
|
XftDraw *draw = XftDrawCreate(_display, d, _screen->getVisual(),
|
||||||
if (_xftfont) {
|
_screen->getColormap());
|
||||||
XftDraw *draw = XftDrawCreate(_display, d, _screen->getVisual(),
|
assert(draw);
|
||||||
_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;
|
XftColor c;
|
||||||
c.color.red = color.red() | color.red() << 8;
|
c.color.red = 0;
|
||||||
c.color.green = color.green() | color.green() << 8;
|
c.color.green = 0;
|
||||||
c.color.blue = color.blue() | color.blue() << 8;
|
c.color.blue = 0;
|
||||||
c.pixel = color.pixel();
|
c.color.alpha = _tint | _tint << 8; // transparent shadow
|
||||||
c.color.alpha = 0xff | 0xff << 8; // no transparency in BColor yet
|
c.pixel = BlackPixel(_display, _screen->getScreenNumber());
|
||||||
|
|
||||||
#ifdef XFT_UTF8
|
XftDrawStringUtf8(draw, &c, _xftfont, x + _offset,
|
||||||
XftDrawStringUtf8(
|
_xftfont->ascent + y + _offset,
|
||||||
#else
|
(XftChar8 *) string.c_str(),
|
||||||
XftDrawString8(
|
string.size());
|
||||||
#endif
|
|
||||||
draw, &c, _xftfont, x, _xftfont->ascent + y,
|
|
||||||
(XftChar8 *) string.c_str(), string.size());
|
|
||||||
|
|
||||||
XftDrawDestroy(draw);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
#endif // XFT
|
|
||||||
|
|
||||||
BPen pen(color, _font);
|
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
|
||||||
|
|
||||||
if (i18n.multibyte())
|
XftDrawStringUtf8(draw, &c, _xftfont, x, _xftfont->ascent + y,
|
||||||
XmbDrawString(_display, d, _fontset, pen.gc(),
|
(XftChar8 *) string.c_str(), string.size());
|
||||||
x, y - _fontset_extents->max_ink_extent.y,
|
|
||||||
string.c_str(), string.size());
|
XftDrawDestroy(draw);
|
||||||
else
|
return;
|
||||||
XDrawString(_display, d, pen.gc(),
|
|
||||||
x, _font->ascent + y,
|
|
||||||
string.c_str(), string.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int BFont::measureString(const string &string) const {
|
unsigned int BFont::measureString(const string &string) const {
|
||||||
assert(_valid);
|
assert(_valid);
|
||||||
|
|
||||||
#ifdef XFT
|
XGlyphInfo info;
|
||||||
if (_xftfont) {
|
|
||||||
XGlyphInfo info;
|
|
||||||
|
|
||||||
#ifdef XFT_UTF8
|
XftTextExtentsUtf8(_display, _xftfont, (XftChar8 *) string.c_str(),
|
||||||
XftTextExtentsUtf8(
|
string.size(), &info);
|
||||||
#else
|
|
||||||
XftTextExtents8(
|
|
||||||
#endif
|
|
||||||
_display, _xftfont, (XftChar8 *) string.c_str(),
|
|
||||||
string.size(), &info);
|
|
||||||
|
|
||||||
return info.xOff + (_shadow ? _offset : 0);
|
return info.xOff + (_shadow ? _offset : 0);
|
||||||
}
|
|
||||||
#endif // XFT
|
|
||||||
|
|
||||||
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());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int BFont::height(void) const {
|
unsigned int BFont::height(void) const {
|
||||||
assert(_valid);
|
assert(_valid);
|
||||||
|
|
||||||
#ifdef XFT
|
return _xftfont->height + (_shadow ? _offset : 0);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int BFont::maxCharWidth(void) const {
|
unsigned int BFont::maxCharWidth(void) const {
|
||||||
assert(_valid);
|
assert(_valid);
|
||||||
|
|
||||||
#ifdef XFT
|
return _xftfont->max_advance_width;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
22
src/font.hh
22
src/font.hh
|
@ -27,9 +27,7 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
#ifdef XFT
|
#include <X11/Xft/Xft.h>
|
||||||
# include <X11/Xft/Xft.h>
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -69,7 +67,6 @@ private:
|
||||||
bool _bold;
|
bool _bold;
|
||||||
bool _italic;
|
bool _italic;
|
||||||
|
|
||||||
#ifdef XFT
|
|
||||||
bool _antialias;
|
bool _antialias;
|
||||||
bool _shadow;
|
bool _shadow;
|
||||||
unsigned char _offset;
|
unsigned char _offset;
|
||||||
|
@ -78,31 +75,14 @@ private:
|
||||||
XftFont *_xftfont;
|
XftFont *_xftfont;
|
||||||
|
|
||||||
bool createXftFont(void);
|
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;
|
bool _valid;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
#ifdef XFT
|
|
||||||
// loads an Xft font
|
// loads an Xft font
|
||||||
BFont(Display *d, BScreen *screen, const std::string &family, int size,
|
BFont(Display *d, BScreen *screen, const std::string &family, int size,
|
||||||
bool bold, bool italic, bool shadow, unsigned char offset,
|
bool bold, bool italic, bool shadow, unsigned char offset,
|
||||||
unsigned char tint, bool antialias = True);
|
unsigned char tint, bool antialias = True);
|
||||||
#endif
|
|
||||||
// loads a standard X font
|
|
||||||
BFont(Display *d, BScreen *screen, const std::string &xlfd);
|
|
||||||
virtual ~BFont(void);
|
virtual ~BFont(void);
|
||||||
|
|
||||||
inline bool valid(void) const { return _valid; }
|
inline bool valid(void) const { return _valid; }
|
||||||
|
|
12
src/image.cc
12
src/image.cc
|
@ -87,8 +87,7 @@ Pixmap BImage::render_solid(const BTexture &texture) {
|
||||||
control->getDrawable(), width,
|
control->getDrawable(), width,
|
||||||
height, control->getDepth());
|
height, control->getDepth());
|
||||||
if (pixmap == None) {
|
if (pixmap == None) {
|
||||||
fprintf(stderr, i18n(ImageSet, ImageErrorCreatingSolidPixmap,
|
fprintf(stderr, "BImage::render_solid: error creating pixmap\n");
|
||||||
"BImage::render_solid: error creating pixmap\n"));
|
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,8 +453,7 @@ XImage *BImage::renderXImage(void) {
|
||||||
width, height, 32, 0);
|
width, height, 32, 0);
|
||||||
|
|
||||||
if (! image) {
|
if (! image) {
|
||||||
fprintf(stderr, i18n(ImageSet, ImageErrorCreatingXImage,
|
fprintf(stderr, "BImage::renderXImage: error creating XImage\n");
|
||||||
"BImage::renderXImage: error creating XImage\n"));
|
|
||||||
return (XImage *) 0;
|
return (XImage *) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -550,8 +548,7 @@ XImage *BImage::renderXImage(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unsupported) {
|
if (unsupported) {
|
||||||
fprintf(stderr, i18n(ImageSet, ImageUnsupVisual,
|
fprintf(stderr, "BImage::renderXImage: unsupported visual\n");
|
||||||
"BImage::renderXImage: unsupported visual\n"));
|
|
||||||
delete [] d;
|
delete [] d;
|
||||||
XDestroyImage(image);
|
XDestroyImage(image);
|
||||||
return (XImage *) 0;
|
return (XImage *) 0;
|
||||||
|
@ -569,8 +566,7 @@ Pixmap BImage::renderPixmap(void) {
|
||||||
control->getDrawable(), width, height, control->getDepth());
|
control->getDrawable(), width, height, control->getDepth());
|
||||||
|
|
||||||
if (pixmap == None) {
|
if (pixmap == None) {
|
||||||
fprintf(stderr, i18n(ImageSet, ImageErrorCreatingPixmap,
|
fprintf(stderr, "BImage::renderPixmap: error creating pixmap\n");
|
||||||
"BImage::renderPixmap: error creating pixmap\n"));
|
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,9 +138,7 @@ private:
|
||||||
bool dither;
|
bool dither;
|
||||||
BaseDisplay *basedisplay;
|
BaseDisplay *basedisplay;
|
||||||
const ScreenInfo *screeninfo;
|
const ScreenInfo *screeninfo;
|
||||||
#ifdef TIMEDCACHE
|
|
||||||
BTimer *timer;
|
BTimer *timer;
|
||||||
#endif // TIMEDCACHE
|
|
||||||
|
|
||||||
Colormap colormap;
|
Colormap colormap;
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,6 @@ BImageControl::BImageControl(BaseDisplay *dpy, const ScreenInfo *scrn,
|
||||||
setColorsPerChannel(_cpc);
|
setColorsPerChannel(_cpc);
|
||||||
|
|
||||||
cache_max = cmax;
|
cache_max = cmax;
|
||||||
#ifdef TIMEDCACHE
|
|
||||||
if (cache_timeout) {
|
if (cache_timeout) {
|
||||||
timer = new BTimer(basedisplay, this);
|
timer = new BTimer(basedisplay, this);
|
||||||
timer->setTimeout(cache_timeout);
|
timer->setTimeout(cache_timeout);
|
||||||
|
@ -81,7 +80,6 @@ BImageControl::BImageControl(BaseDisplay *dpy, const ScreenInfo *scrn,
|
||||||
} else {
|
} else {
|
||||||
timer = (BTimer *) 0;
|
timer = (BTimer *) 0;
|
||||||
}
|
}
|
||||||
#endif // TIMEDCACHE
|
|
||||||
|
|
||||||
colors = (XColor *) 0;
|
colors = (XColor *) 0;
|
||||||
ncolors = 0;
|
ncolors = 0;
|
||||||
|
@ -151,9 +149,8 @@ BImageControl::BImageControl(BaseDisplay *dpy, const ScreenInfo *scrn,
|
||||||
|
|
||||||
if (colors_per_channel < 2 || ncolors > (1 << screen_depth)) {
|
if (colors_per_channel < 2 || ncolors > (1 << screen_depth)) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
i18n(ImageSet, ImageInvalidColormapSize,
|
"BImageControl::BImageControl: invalid colormap size %d "
|
||||||
"BImageControl::BImageControl: invalid colormap size %d "
|
"(%d/%d/%d) - reducing",
|
||||||
"(%d/%d/%d) - reducing"),
|
|
||||||
ncolors, colors_per_channel, colors_per_channel,
|
ncolors, colors_per_channel, colors_per_channel,
|
||||||
colors_per_channel);
|
colors_per_channel);
|
||||||
|
|
||||||
|
@ -162,9 +159,8 @@ BImageControl::BImageControl(BaseDisplay *dpy, const ScreenInfo *scrn,
|
||||||
|
|
||||||
colors = new XColor[ncolors];
|
colors = new XColor[ncolors];
|
||||||
if (! colors) {
|
if (! colors) {
|
||||||
fprintf(stderr, i18n(ImageSet, ImageErrorAllocatingColormap,
|
fprintf(stderr, "BImageControl::BImageControl: error allocating "
|
||||||
"BImageControl::BImageControl: error allocating "
|
"colormap\n");
|
||||||
"colormap\n"));
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,8 +189,7 @@ BImageControl::BImageControl(BaseDisplay *dpy, const ScreenInfo *scrn,
|
||||||
|
|
||||||
for (i = 0; i < ncolors; i++) {
|
for (i = 0; i < ncolors; i++) {
|
||||||
if (! XAllocColor(basedisplay->getXDisplay(), colormap, &colors[i])) {
|
if (! XAllocColor(basedisplay->getXDisplay(), colormap, &colors[i])) {
|
||||||
fprintf(stderr, i18n(ImageSet, ImageColorAllocFail,
|
fprintf(stderr, "couldn't alloc color %i %i %i\n",
|
||||||
"couldn't alloc color %i %i %i\n"),
|
|
||||||
colors[i].red, colors[i].green, colors[i].blue);
|
colors[i].red, colors[i].green, colors[i].blue);
|
||||||
colors[i].flags = 0;
|
colors[i].flags = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -259,9 +254,8 @@ BImageControl::BImageControl(BaseDisplay *dpy, const ScreenInfo *scrn,
|
||||||
|
|
||||||
if (colors_per_channel < 2 || ncolors > (1 << screen_depth)) {
|
if (colors_per_channel < 2 || ncolors > (1 << screen_depth)) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
i18n(ImageSet, ImageInvalidColormapSize,
|
"BImageControl::BImageControl: invalid colormap size %d "
|
||||||
"BImageControl::BImageControl: invalid colormap size %d "
|
"(%d/%d/%d) - reducing",
|
||||||
"(%d/%d/%d) - reducing"),
|
|
||||||
ncolors, colors_per_channel, colors_per_channel,
|
ncolors, colors_per_channel, colors_per_channel,
|
||||||
colors_per_channel);
|
colors_per_channel);
|
||||||
|
|
||||||
|
@ -271,8 +265,7 @@ BImageControl::BImageControl(BaseDisplay *dpy, const ScreenInfo *scrn,
|
||||||
colors = new XColor[ncolors];
|
colors = new XColor[ncolors];
|
||||||
if (! colors) {
|
if (! colors) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
i18n(ImageSet, ImageErrorAllocatingColormap,
|
"BImageControl::BImageControl: error allocating colormap\n");
|
||||||
"BImageControl::BImageControl: error allocating colormap\n"));
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,8 +284,7 @@ BImageControl::BImageControl(BaseDisplay *dpy, const ScreenInfo *scrn,
|
||||||
|
|
||||||
if (! XAllocColor(basedisplay->getXDisplay(), colormap,
|
if (! XAllocColor(basedisplay->getXDisplay(), colormap,
|
||||||
&colors[i])) {
|
&colors[i])) {
|
||||||
fprintf(stderr, i18n(ImageSet, ImageColorAllocFail,
|
fprintf(stderr, "couldn't alloc color %i %i %i\n",
|
||||||
"couldn't alloc color %i %i %i\n"),
|
|
||||||
colors[i].red, colors[i].green, colors[i].blue);
|
colors[i].red, colors[i].green, colors[i].blue);
|
||||||
colors[i].flags = 0;
|
colors[i].flags = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -343,9 +335,7 @@ BImageControl::BImageControl(BaseDisplay *dpy, const ScreenInfo *scrn,
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr,
|
fprintf(stderr, "BImageControl::BImageControl: unsupported visual %d\n",
|
||||||
i18n(ImageSet, ImageUnsupVisual,
|
|
||||||
"BImageControl::BImageControl: unsupported visual %d\n"),
|
|
||||||
getVisual()->c_class);
|
getVisual()->c_class);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -372,21 +362,18 @@ BImageControl::~BImageControl(void) {
|
||||||
|
|
||||||
if (! cache.empty()) {
|
if (! cache.empty()) {
|
||||||
//#ifdef DEBUG
|
//#ifdef DEBUG
|
||||||
fprintf(stderr, i18n(ImageSet, ImagePixmapRelease,
|
fprintf(stderr, "BImageContol::~BImageControl: pixmap cache - "
|
||||||
"BImageContol::~BImageControl: pixmap cache - "
|
"releasing %d pixmaps\n", cache.size());
|
||||||
"releasing %d pixmaps\n"), cache.size());
|
|
||||||
//#endif
|
//#endif
|
||||||
CacheContainer::iterator it = cache.begin();
|
CacheContainer::iterator it = cache.begin();
|
||||||
const CacheContainer::iterator end = cache.end();
|
const CacheContainer::iterator end = cache.end();
|
||||||
for (; it != end; ++it)
|
for (; it != end; ++it)
|
||||||
XFreePixmap(basedisplay->getXDisplay(), it->pixmap);
|
XFreePixmap(basedisplay->getXDisplay(), it->pixmap);
|
||||||
}
|
}
|
||||||
#ifdef TIMEDCACHE
|
|
||||||
if (timer) {
|
if (timer) {
|
||||||
timer->stop();
|
timer->stop();
|
||||||
delete timer;
|
delete timer;
|
||||||
}
|
}
|
||||||
#endif // TIMEDCACHE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -449,9 +436,8 @@ Pixmap BImageControl::renderImage(unsigned int width, unsigned int height,
|
||||||
|
|
||||||
if (cache.size() > cache_max) {
|
if (cache.size() > cache_max) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, i18n(ImageSet, ImagePixmapCacheLarge,
|
fprintf(stderr, "BImageControl::renderImage: cache is large, "
|
||||||
"BImageControl::renderImage: cache is large, "
|
"forcing cleanout\n");
|
||||||
"forcing cleanout\n"));
|
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
|
||||||
timeout();
|
timeout();
|
||||||
|
@ -473,9 +459,7 @@ void BImageControl::removeImage(Pixmap pixmap) {
|
||||||
tmp.count--;
|
tmp.count--;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TIMEDCACHE
|
|
||||||
if (! timer)
|
if (! timer)
|
||||||
#endif // TIMEDCACHE
|
|
||||||
timeout();
|
timeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
74
src/main.cc
74
src/main.cc
|
@ -55,58 +55,52 @@ using std::string;
|
||||||
#include "blackbox.hh"
|
#include "blackbox.hh"
|
||||||
|
|
||||||
|
|
||||||
I18n i18n; // initialized in main
|
|
||||||
|
|
||||||
static void showHelp(int exitval) {
|
static void showHelp(int exitval) {
|
||||||
// print program usage and command line options
|
// print program usage and command line options
|
||||||
printf(i18n(mainSet, mainUsage,
|
printf("Openbox %s : (c) 2002 - 2002 Ben Jansens\n"
|
||||||
"Openbox %s : (c) 2002 - 2002 Ben Jansens\n"
|
" -display <string>\t\tuse display connection.\n"
|
||||||
" 2001 - 2002 Sean 'Shaleh' Perry\n"
|
" -rc <string>\t\t\tuse alternate resource file.\n"
|
||||||
" 1997 - 2000, 2002 Brad Hughes\n\n"
|
" -menu <string>\t\tuse alternate menu file.\n"
|
||||||
" -display <string>\t\tuse display connection.\n"
|
" -version\t\t\tdisplay version and exit.\n"
|
||||||
" -rc <string>\t\t\tuse alternate resource file.\n"
|
" -help\t\t\t\tdisplay this help text and exit.\n\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);
|
OPENBOX_VERSION);
|
||||||
|
|
||||||
// some people have requested that we print out compile options
|
// some people have requested that we print out compile options
|
||||||
// as well
|
// as well
|
||||||
printf(i18n(mainSet, mainCompileOptions,
|
printf("Compile time options:\n"
|
||||||
"Compile time options:\n"
|
" Debugging:\t\t\t%s\n"
|
||||||
" Debugging:\t\t\t%s\n"
|
" Shape:\t\t\t%s\n"
|
||||||
" Shape:\t\t\t%s\n"
|
" Xft:\t\t\t\t%s\n"
|
||||||
" Xft:\t\t\t\t%s\n"
|
" Xinerama:\t\t\t%s\n"
|
||||||
" Xinerama:\t\t\t%s\n"
|
" 8bpp Ordered Dithering:\t%s\n\n",
|
||||||
" 8bpp Ordered Dithering:\t%s\n\n"),
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
i18n(CommonSet, CommonYes, "yes"),
|
"yes",
|
||||||
#else // !DEBUG
|
#else // !DEBUG
|
||||||
i18n(CommonSet, CommonNo, "no"),
|
"no",
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
|
||||||
#ifdef SHAPE
|
#ifdef SHAPE
|
||||||
i18n(CommonSet, CommonYes, "yes"),
|
"yes",
|
||||||
#else // !SHAPE
|
#else // !SHAPE
|
||||||
i18n(CommonSet, CommonNo, "no"),
|
"no",
|
||||||
#endif // SHAPE
|
#endif // SHAPE
|
||||||
|
|
||||||
#ifdef XFT
|
#ifdef XFT
|
||||||
i18n(CommonSet, CommonYes, "yes"),
|
"yes",
|
||||||
#else // !XFT
|
#else // !XFT
|
||||||
i18n(CommonSet, CommonNo, "no"),
|
"no",
|
||||||
#endif // XFT
|
#endif // XFT
|
||||||
|
|
||||||
#ifdef XINERAMA
|
#ifdef XINERAMA
|
||||||
i18n(CommonSet, CommonYes, "yes"),
|
"yes",
|
||||||
#else // !XINERAMA
|
#else // !XINERAMA
|
||||||
i18n(CommonSet, CommonNo, "no"),
|
"no",
|
||||||
#endif // XINERAMA
|
#endif // XINERAMA
|
||||||
|
|
||||||
#ifdef ORDEREDPSEUDO
|
#ifdef ORDEREDPSEUDO
|
||||||
i18n(CommonSet, CommonYes, "yes")
|
"yes"
|
||||||
#else // !ORDEREDPSEUDO
|
#else // !ORDEREDPSEUDO
|
||||||
i18n(CommonSet, CommonNo, "no")
|
"no"
|
||||||
#endif // ORDEREDPSEUDO
|
#endif // ORDEREDPSEUDO
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -118,16 +112,12 @@ int main(int argc, char **argv) {
|
||||||
char *rc_file = (char *) 0;
|
char *rc_file = (char *) 0;
|
||||||
char *menu_file = (char *) 0;
|
char *menu_file = (char *) 0;
|
||||||
|
|
||||||
i18n.openCatalog("openbox.cat");
|
|
||||||
|
|
||||||
for (int i = 1; i < argc; ++i) {
|
for (int i = 1; i < argc; ++i) {
|
||||||
if (! strcmp(argv[i], "-rc")) {
|
if (! strcmp(argv[i], "-rc")) {
|
||||||
// look for alternative rc file to use
|
// look for alternative rc file to use
|
||||||
|
|
||||||
if ((++i) >= argc) {
|
if ((++i) >= argc) {
|
||||||
fprintf(stderr,
|
fprintf(stderr, "error: '-rc' requires and argument\n");
|
||||||
i18n(mainSet, mainRCRequiresArg,
|
|
||||||
"error: '-rc' requires and argument\n"));
|
|
||||||
|
|
||||||
::exit(1);
|
::exit(1);
|
||||||
}
|
}
|
||||||
|
@ -137,9 +127,7 @@ int main(int argc, char **argv) {
|
||||||
// look for alternative menu file to use
|
// look for alternative menu file to use
|
||||||
|
|
||||||
if ((++i) >= argc) {
|
if ((++i) >= argc) {
|
||||||
fprintf(stderr,
|
fprintf(stderr, "error: '-menu' requires and argument\n");
|
||||||
i18n(mainSet, mainMENURequiresArg,
|
|
||||||
"error: '-menu' requires and argument\n"));
|
|
||||||
|
|
||||||
::exit(1);
|
::exit(1);
|
||||||
}
|
}
|
||||||
|
@ -150,9 +138,7 @@ int main(int argc, char **argv) {
|
||||||
// set by the environment variable DISPLAY
|
// set by the environment variable DISPLAY
|
||||||
|
|
||||||
if ((++i) >= argc) {
|
if ((++i) >= argc) {
|
||||||
fprintf(stderr,
|
fprintf(stderr, "error: '-display' requires an argument\n");
|
||||||
i18n(mainSet, mainDISPLAYRequiresArg,
|
|
||||||
"error: '-display' requires an argument\n"));
|
|
||||||
|
|
||||||
::exit(1);
|
::exit(1);
|
||||||
}
|
}
|
||||||
|
@ -162,15 +148,13 @@ int main(int argc, char **argv) {
|
||||||
dtmp += session_display;
|
dtmp += session_display;
|
||||||
|
|
||||||
if (putenv(const_cast<char*>(dtmp.c_str()))) {
|
if (putenv(const_cast<char*>(dtmp.c_str()))) {
|
||||||
fprintf(stderr, i18n(mainSet, mainWarnDisplaySet,
|
fprintf(stderr,
|
||||||
"warning: couldn't set environment variable 'DISPLAY'\n"));
|
"warning: couldn't set environment variable 'DISPLAY'\n");
|
||||||
perror("putenv()");
|
perror("putenv()");
|
||||||
}
|
}
|
||||||
} else if (! strcmp(argv[i], "-version")) {
|
} else if (! strcmp(argv[i], "-version")) {
|
||||||
// print current version string
|
// print current version string
|
||||||
printf("Openbox %s : (c) 2002 - 2002 Ben Jansens\n"
|
printf("Openbox %s : (c) 2002 - 2002 Ben Jansens\n",
|
||||||
" 2001 - 2002 Sean 'Shaleh' Perry\n"
|
|
||||||
" 1997 - 2000, 2002 Brad Hughes\n\n",
|
|
||||||
OPENBOX_VERSION);
|
OPENBOX_VERSION);
|
||||||
|
|
||||||
::exit(0);
|
::exit(0);
|
||||||
|
@ -185,7 +169,7 @@ int main(int argc, char **argv) {
|
||||||
_chdir2(getenv("X11ROOT"));
|
_chdir2(getenv("X11ROOT"));
|
||||||
#endif // __EMX__
|
#endif // __EMX__
|
||||||
|
|
||||||
Blackbox blackbox(argv, session_display, rc_file, menu_file);
|
Blackbox blackbox(argv, session_display, rc_file);
|
||||||
blackbox.eventLoop();
|
blackbox.eventLoop();
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
|
|
995
src/screen.cc
995
src/screen.cc
File diff suppressed because it is too large
Load diff
108
src/screen.hh
108
src/screen.hh
|
@ -45,13 +45,8 @@ extern "C" {
|
||||||
#include "color.hh"
|
#include "color.hh"
|
||||||
#include "texture.hh"
|
#include "texture.hh"
|
||||||
#include "image.hh"
|
#include "image.hh"
|
||||||
#include "configmenu.hh"
|
|
||||||
#include "iconmenu.hh"
|
|
||||||
#include "netizen.hh"
|
|
||||||
#include "rootmenu.hh"
|
|
||||||
#include "timer.hh"
|
#include "timer.hh"
|
||||||
#include "workspace.hh"
|
#include "workspace.hh"
|
||||||
#include "workspacemenu.hh"
|
|
||||||
#include "blackbox.hh"
|
#include "blackbox.hh"
|
||||||
|
|
||||||
class Slit; // forward reference
|
class Slit; // forward reference
|
||||||
|
@ -86,36 +81,6 @@ struct WindowStyle {
|
||||||
unsigned int max_length, unsigned int modifier) const;
|
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 {
|
class BScreen : public ScreenInfo {
|
||||||
private:
|
private:
|
||||||
bool root_colormap_installed, managed, geom_visible;
|
bool root_colormap_installed, managed, geom_visible;
|
||||||
|
@ -125,26 +90,15 @@ private:
|
||||||
|
|
||||||
Blackbox *blackbox;
|
Blackbox *blackbox;
|
||||||
BImageControl *image_control;
|
BImageControl *image_control;
|
||||||
Configmenu *configmenu;
|
|
||||||
Iconmenu *iconmenu;
|
|
||||||
Rootmenu *rootmenu;
|
|
||||||
Configuration *config;
|
Configuration *config;
|
||||||
XAtom *xatom;
|
XAtom *xatom;
|
||||||
|
|
||||||
typedef std::list<Rootmenu*> RootmenuList;
|
|
||||||
RootmenuList rootmenuList;
|
|
||||||
|
|
||||||
typedef std::list<Netizen*> NetizenList;
|
|
||||||
NetizenList netizenList;
|
|
||||||
BlackboxWindowList iconList, windowList;
|
BlackboxWindowList iconList, windowList;
|
||||||
|
|
||||||
typedef std::vector<Window> WindowList;
|
typedef std::vector<Window> WindowList;
|
||||||
WindowList specialWindowList, desktopWindowList, systrayWindowList;
|
WindowList specialWindowList, desktopWindowList, systrayWindowList;
|
||||||
|
|
||||||
Slit *slit;
|
|
||||||
Toolbar *toolbar;
|
|
||||||
Workspace *current_workspace;
|
Workspace *current_workspace;
|
||||||
Workspacemenu *workspacemenu;
|
|
||||||
|
|
||||||
unsigned int geom_w, geom_h;
|
unsigned int geom_w, geom_h;
|
||||||
unsigned long event_mask;
|
unsigned long event_mask;
|
||||||
|
@ -161,12 +115,10 @@ private:
|
||||||
|
|
||||||
struct screen_resource {
|
struct screen_resource {
|
||||||
WindowStyle wstyle;
|
WindowStyle wstyle;
|
||||||
ToolbarStyle tstyle;
|
|
||||||
MenuStyle mstyle;
|
|
||||||
|
|
||||||
bool sloppy_focus, auto_raise, auto_edge_balance, ordered_dither,
|
bool sloppy_focus, auto_raise, auto_edge_balance, ordered_dither,
|
||||||
opaque_move, full_max, focus_new, focus_last, click_raise,
|
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;
|
ignore_shaded, ignore_maximized, workspace_warping, shadow_fonts;
|
||||||
|
|
||||||
int snap_to_windows, snap_to_edges;
|
int snap_to_windows, snap_to_edges;
|
||||||
|
@ -175,21 +127,14 @@ private:
|
||||||
BColor border_color;
|
BColor border_color;
|
||||||
|
|
||||||
unsigned int workspaces;
|
unsigned int workspaces;
|
||||||
int toolbar_placement, toolbar_width_percent, placement_policy,
|
int placement_policy,
|
||||||
snap_threshold, row_direction, col_direction, root_scroll,
|
snap_threshold, row_direction, col_direction, root_scroll,
|
||||||
resistance_size;
|
resistance_size;
|
||||||
|
|
||||||
unsigned int handle_width, bevel_width, frame_width, border_width,
|
unsigned int handle_width, bevel_width, frame_width, border_width,
|
||||||
resize_zones;
|
resize_zones;
|
||||||
|
|
||||||
unsigned int root_menu_button, workspace_menu_button;
|
|
||||||
|
|
||||||
#ifdef HAVE_STRFTIME
|
|
||||||
std::string strftime_format;
|
std::string strftime_format;
|
||||||
#else // !HAVE_STRFTIME
|
|
||||||
bool clock24hour;
|
|
||||||
int date_format;
|
|
||||||
#endif // HAVE_STRFTIME
|
|
||||||
|
|
||||||
} resource;
|
} resource;
|
||||||
std::string screenstr;
|
std::string screenstr;
|
||||||
|
@ -197,8 +142,6 @@ private:
|
||||||
BScreen(const BScreen&);
|
BScreen(const BScreen&);
|
||||||
BScreen& operator=(const BScreen&);
|
BScreen& operator=(const BScreen&);
|
||||||
|
|
||||||
bool parseMenuFile(FILE *file, Rootmenu *menu);
|
|
||||||
|
|
||||||
#ifdef BITMAPBUTTONS
|
#ifdef BITMAPBUTTONS
|
||||||
void readDatabaseMask(const std::string &rname,
|
void readDatabaseMask(const std::string &rname,
|
||||||
PixmapMask &pixmapMask,
|
PixmapMask &pixmapMask,
|
||||||
|
@ -215,11 +158,16 @@ private:
|
||||||
BFont *readDatabaseFont(const std::string &rbasename,
|
BFont *readDatabaseFont(const std::string &rbasename,
|
||||||
const Configuration &style);
|
const Configuration &style);
|
||||||
|
|
||||||
void InitMenu(void);
|
|
||||||
void LoadStyle(void);
|
void LoadStyle(void);
|
||||||
|
|
||||||
void updateWorkArea(void);
|
void updateWorkArea(void);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// XXX: temporary
|
||||||
|
void updateNetizenWorkspaceCount();
|
||||||
|
void updateNetizenWindowFocus();
|
||||||
|
|
||||||
|
|
||||||
enum { WindowNoSnap = 0, WindowSnap, WindowResistance };
|
enum { WindowNoSnap = 0, WindowSnap, WindowResistance };
|
||||||
enum { RowSmartPlacement = 1, ColSmartPlacement, CascadePlacement,
|
enum { RowSmartPlacement = 1, ColSmartPlacement, CascadePlacement,
|
||||||
UnderMousePlacement, ClickMousePlacement, LeftRight, RightLeft,
|
UnderMousePlacement, ClickMousePlacement, LeftRight, RightLeft,
|
||||||
|
@ -248,7 +196,6 @@ public:
|
||||||
inline bool doFullMax(void) const { return resource.full_max; }
|
inline bool doFullMax(void) const { return resource.full_max; }
|
||||||
inline bool doFocusNew(void) const { return resource.focus_new; }
|
inline bool doFocusNew(void) const { return resource.focus_new; }
|
||||||
inline bool doFocusLast(void) const { return resource.focus_last; }
|
inline bool doFocusLast(void) const { return resource.focus_last; }
|
||||||
inline bool doHideToolbar(void) const { return resource.hide_toolbar; }
|
|
||||||
inline int getWindowToWindowSnap(void) const
|
inline int getWindowToWindowSnap(void) const
|
||||||
{ return resource.snap_to_windows; }
|
{ return resource.snap_to_windows; }
|
||||||
inline int getWindowToEdgeSnap(void) const
|
inline int getWindowToEdgeSnap(void) const
|
||||||
|
@ -259,27 +206,17 @@ public:
|
||||||
inline bool doWorkspaceWarping(void) const
|
inline bool doWorkspaceWarping(void) const
|
||||||
{ return resource.workspace_warping; }
|
{ return resource.workspace_warping; }
|
||||||
inline int rootScrollDirection(void) const { return resource.root_scroll; }
|
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 const GC &getOpGC(void) const { return opGC; }
|
||||||
|
|
||||||
inline Blackbox *getBlackbox(void) { return blackbox; }
|
inline Blackbox *getBlackbox(void) { return blackbox; }
|
||||||
inline BColor *getBorderColor(void) { return &resource.border_color; }
|
inline BColor *getBorderColor(void) { return &resource.border_color; }
|
||||||
inline BImageControl *getImageControl(void) { return image_control; }
|
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;
|
Workspace *getWorkspace(unsigned int index) const;
|
||||||
|
|
||||||
inline Workspace *getCurrentWorkspace(void) { return current_workspace; }
|
inline Workspace *getCurrentWorkspace(void) { return current_workspace; }
|
||||||
|
|
||||||
inline Workspacemenu *getWorkspacemenu(void) { return workspacemenu; }
|
|
||||||
|
|
||||||
inline unsigned int getHandleWidth(void) const
|
inline unsigned int getHandleWidth(void) const
|
||||||
{ return resource.handle_width; }
|
{ return resource.handle_width; }
|
||||||
inline unsigned int getBevelWidth(void) const
|
inline unsigned int getBevelWidth(void) const
|
||||||
|
@ -335,7 +272,6 @@ public:
|
||||||
void saveFullMax(bool f);
|
void saveFullMax(bool f);
|
||||||
void saveFocusNew(bool f);
|
void saveFocusNew(bool f);
|
||||||
void saveFocusLast(bool f);
|
void saveFocusLast(bool f);
|
||||||
void saveHideToolbar(bool h);
|
|
||||||
void saveWindowToEdgeSnap(int s);
|
void saveWindowToEdgeSnap(int s);
|
||||||
void saveWindowToWindowSnap(int s);
|
void saveWindowToWindowSnap(int s);
|
||||||
void saveWindowCornerSnap(bool s);
|
void saveWindowCornerSnap(bool s);
|
||||||
|
@ -345,24 +281,12 @@ public:
|
||||||
void saveAllowScrollLock(bool a);
|
void saveAllowScrollLock(bool a);
|
||||||
void saveWorkspaceWarping(bool w);
|
void saveWorkspaceWarping(bool w);
|
||||||
void saveRootScrollDirection(int d);
|
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)
|
inline const char *getStrftimeFormat(void)
|
||||||
{ return resource.strftime_format.c_str(); }
|
{ return resource.strftime_format.c_str(); }
|
||||||
void saveStrftimeFormat(const std::string& format);
|
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 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);
|
BlackboxWindow *getIcon(unsigned int index);
|
||||||
|
|
||||||
|
@ -381,9 +305,6 @@ public:
|
||||||
void changeWorkspaceID(unsigned int id);
|
void changeWorkspaceID(unsigned int id);
|
||||||
void saveWorkspaceNames(void);
|
void saveWorkspaceNames(void);
|
||||||
|
|
||||||
void addNetizen(Netizen *n);
|
|
||||||
void removeNetizen(Window w);
|
|
||||||
|
|
||||||
void addSystrayWindow(Window window);
|
void addSystrayWindow(Window window);
|
||||||
void removeSystrayWindow(Window window);
|
void removeSystrayWindow(Window window);
|
||||||
|
|
||||||
|
@ -406,26 +327,13 @@ public:
|
||||||
void save_rc(void);
|
void save_rc(void);
|
||||||
void reconfigure(void);
|
void reconfigure(void);
|
||||||
void toggleFocusModel(FocusModel model);
|
void toggleFocusModel(FocusModel model);
|
||||||
void rereadMenu(void);
|
|
||||||
void shutdown(void);
|
void shutdown(void);
|
||||||
void showPosition(int x, int y);
|
void showPosition(int x, int y);
|
||||||
void showGeometry(unsigned int gx, unsigned int gy);
|
void showGeometry(unsigned int gx, unsigned int gy);
|
||||||
void hideGeometry(void);
|
void hideGeometry(void);
|
||||||
|
|
||||||
void showWorkspaceMenu(int x, int y);
|
|
||||||
void showRootMenu(int x, int y);
|
|
||||||
|
|
||||||
void buttonPressEvent(const XButtonEvent *xbutton);
|
void buttonPressEvent(const XButtonEvent *xbutton);
|
||||||
void propertyNotifyEvent(const XPropertyEvent *pe);
|
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);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
109
src/window.cc
109
src/window.cc
|
@ -45,18 +45,13 @@ extern "C" {
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "blackbox.hh"
|
#include "blackbox.hh"
|
||||||
#include "clientmenu.hh"
|
|
||||||
#include "font.hh"
|
#include "font.hh"
|
||||||
#include "gccache.hh"
|
#include "gccache.hh"
|
||||||
#include "iconmenu.hh"
|
|
||||||
#include "image.hh"
|
#include "image.hh"
|
||||||
#include "screen.hh"
|
#include "screen.hh"
|
||||||
#include "toolbar.hh"
|
|
||||||
#include "util.hh"
|
#include "util.hh"
|
||||||
#include "window.hh"
|
#include "window.hh"
|
||||||
#include "windowmenu.hh"
|
|
||||||
#include "workspace.hh"
|
#include "workspace.hh"
|
||||||
#include "slit.hh"
|
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::abs;
|
using std::abs;
|
||||||
|
@ -149,8 +144,6 @@ BlackboxWindow::BlackboxWindow(Blackbox *b, Window w, BScreen *s) {
|
||||||
|
|
||||||
current_state = NormalState;
|
current_state = NormalState;
|
||||||
|
|
||||||
windowmenu = 0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
set the initial size and location of client window (relative to the
|
set the initial size and location of client window (relative to the
|
||||||
_root window_). This position is the reference point used with the
|
_root window_). This position is the reference point used with the
|
||||||
|
@ -331,9 +324,6 @@ BlackboxWindow::BlackboxWindow(Blackbox *b, Window w, BScreen *s) {
|
||||||
|
|
||||||
if (flags.maximized && (functions & Func_Maximize))
|
if (flags.maximized && (functions & Func_Maximize))
|
||||||
remaximize();
|
remaximize();
|
||||||
|
|
||||||
// create this last so it only needs to be configured once
|
|
||||||
windowmenu = new Windowmenu(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -359,8 +349,6 @@ BlackboxWindow::~BlackboxWindow(void) {
|
||||||
|
|
||||||
delete timer;
|
delete timer;
|
||||||
|
|
||||||
delete windowmenu;
|
|
||||||
|
|
||||||
if (client.window_group) {
|
if (client.window_group) {
|
||||||
BWindowGroup *group = blackbox->searchGroup(client.window_group);
|
BWindowGroup *group = blackbox->searchGroup(client.window_group);
|
||||||
if (group) group->removeWindow(this);
|
if (group) group->removeWindow(this);
|
||||||
|
@ -974,11 +962,6 @@ void BlackboxWindow::reconfigure(void) {
|
||||||
|
|
||||||
ungrabButtons();
|
ungrabButtons();
|
||||||
grabButtons();
|
grabButtons();
|
||||||
|
|
||||||
if (windowmenu) {
|
|
||||||
windowmenu->move(windowmenu->getX(), frame.rect.y() + frame.title_h);
|
|
||||||
windowmenu->reconfigure();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1161,7 +1144,7 @@ void BlackboxWindow::getWMName(void) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// fall back to an internal default
|
// 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,
|
xatom->setValue(client.window, XAtom::net_wm_visible_name, XAtom::utf8,
|
||||||
client.title);
|
client.title);
|
||||||
|
|
||||||
|
@ -1215,8 +1198,6 @@ void BlackboxWindow::getWMProtocols(void) {
|
||||||
functions |= Func_Close;
|
functions |= Func_Close;
|
||||||
} else if (proto[i] == xatom->getAtom(XAtom::wm_take_focus))
|
} else if (proto[i] == xatom->getAtom(XAtom::wm_take_focus))
|
||||||
flags.send_focus_message = True;
|
flags.send_focus_message = True;
|
||||||
else if (proto[i] == xatom->getAtom(XAtom::blackbox_structure_messages))
|
|
||||||
screen->addNetizen(new Netizen(screen, client.window));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XFree(proto);
|
XFree(proto);
|
||||||
|
@ -1669,7 +1650,6 @@ void BlackboxWindow::configure(int dx, int dy,
|
||||||
|
|
||||||
XSendEvent(blackbox->getXDisplay(), client.window, False,
|
XSendEvent(blackbox->getXDisplay(), client.window, False,
|
||||||
StructureNotifyMask, &event);
|
StructureNotifyMask, &event);
|
||||||
screen->updateNetizenConfigNotify(&event);
|
|
||||||
XFlush(blackbox->getXDisplay());
|
XFlush(blackbox->getXDisplay());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1783,8 +1763,6 @@ void BlackboxWindow::iconify(void) {
|
||||||
if (flags.moving)
|
if (flags.moving)
|
||||||
endMove();
|
endMove();
|
||||||
|
|
||||||
if (windowmenu) windowmenu->hide();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* we don't want this XUnmapWindow call to generate an UnmapNotify event, so
|
* 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.
|
* we need to clear the event mask on client.window for a split second.
|
||||||
|
@ -1921,8 +1899,6 @@ void BlackboxWindow::withdraw(void) {
|
||||||
XSelectInput(blackbox->getXDisplay(), client.window, event_mask);
|
XSelectInput(blackbox->getXDisplay(), client.window, event_mask);
|
||||||
|
|
||||||
XUngrabServer(blackbox->getXDisplay());
|
XUngrabServer(blackbox->getXDisplay());
|
||||||
|
|
||||||
if (windowmenu) windowmenu->hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1934,9 +1910,6 @@ void BlackboxWindow::maximize(unsigned int button) {
|
||||||
if (flags.moving)
|
if (flags.moving)
|
||||||
endMove();
|
endMove();
|
||||||
|
|
||||||
// handle case where menu is open then the max button is used instead
|
|
||||||
if (windowmenu && windowmenu->isVisible()) windowmenu->hide();
|
|
||||||
|
|
||||||
if (flags.maximized) {
|
if (flags.maximized) {
|
||||||
flags.maximized = 0;
|
flags.maximized = 0;
|
||||||
|
|
||||||
|
@ -2257,15 +2230,6 @@ void BlackboxWindow::setFocusFlag(bool focus) {
|
||||||
|
|
||||||
if (flags.focused)
|
if (flags.focused)
|
||||||
blackbox->setFocusedWindow(this);
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2994,7 +2958,6 @@ void BlackboxWindow::propertyNotifyEvent(const XPropertyEvent *pe) {
|
||||||
positionButtons(True);
|
positionButtons(True);
|
||||||
XMapSubwindows(blackbox->getXDisplay(), frame.title);
|
XMapSubwindows(blackbox->getXDisplay(), frame.title);
|
||||||
}
|
}
|
||||||
if (windowmenu) windowmenu->reconfigure();
|
|
||||||
}
|
}
|
||||||
} else if (pe->atom == xatom->getAtom(XAtom::net_wm_strut)) {
|
} else if (pe->atom == xatom->getAtom(XAtom::net_wm_strut)) {
|
||||||
updateStrut();
|
updateStrut();
|
||||||
|
@ -3116,8 +3079,6 @@ void BlackboxWindow::buttonPressEvent(const XButtonEvent *be) {
|
||||||
} else if (frame.stick_button == be->window) {
|
} else if (frame.stick_button == be->window) {
|
||||||
redrawStickyButton(True);
|
redrawStickyButton(True);
|
||||||
} else if (frame.plate == be->window) {
|
} else if (frame.plate == be->window) {
|
||||||
if (windowmenu && windowmenu->isVisible()) windowmenu->hide();
|
|
||||||
|
|
||||||
screen->getWorkspace(blackbox_attrib.workspace)->raiseWindow(this);
|
screen->getWorkspace(blackbox_attrib.workspace)->raiseWindow(this);
|
||||||
|
|
||||||
XAllowEvents(blackbox->getXDisplay(), ReplayPointer, be->time);
|
XAllowEvents(blackbox->getXDisplay(), ReplayPointer, be->time);
|
||||||
|
@ -3133,58 +3094,12 @@ void BlackboxWindow::buttonPressEvent(const XButtonEvent *be) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (windowmenu && windowmenu->isVisible()) windowmenu->hide();
|
|
||||||
|
|
||||||
screen->getWorkspace(blackbox_attrib.workspace)->raiseWindow(this);
|
screen->getWorkspace(blackbox_attrib.workspace)->raiseWindow(this);
|
||||||
}
|
}
|
||||||
} else if (be->button == 2 && (be->window != frame.iconify_button) &&
|
} else if (be->button == 2 && (be->window != frame.iconify_button) &&
|
||||||
(be->window != frame.close_button) &&
|
(be->window != frame.close_button) &&
|
||||||
(be->window != frame.stick_button)) {
|
(be->window != frame.stick_button)) {
|
||||||
screen->getWorkspace(blackbox_attrib.workspace)->lowerWindow(this);
|
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
|
// mouse wheel up
|
||||||
} else if (be->button == 4) {
|
} else if (be->button == 4) {
|
||||||
if ((be->window == frame.label ||
|
if ((be->window == frame.label ||
|
||||||
|
@ -3276,9 +3191,6 @@ void BlackboxWindow::beginMove(int x_root, int y_root) {
|
||||||
GrabModeAsync, GrabModeAsync,
|
GrabModeAsync, GrabModeAsync,
|
||||||
None, blackbox->getMoveCursor(), CurrentTime);
|
None, blackbox->getMoveCursor(), CurrentTime);
|
||||||
|
|
||||||
if (windowmenu && windowmenu->isVisible())
|
|
||||||
windowmenu->hide();
|
|
||||||
|
|
||||||
flags.moving = True;
|
flags.moving = True;
|
||||||
blackbox->setChangingWindow(this);
|
blackbox->setChangingWindow(this);
|
||||||
|
|
||||||
|
@ -3431,25 +3343,6 @@ void BlackboxWindow::doWindowSnapping(int &dx, int &dy) {
|
||||||
if (*st_it != this) // don't snap to ourself
|
if (*st_it != this) // don't snap to ourself
|
||||||
rectlist.push_back( (*st_it)->frameRect() );
|
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();
|
RectList::const_iterator it, end = rectlist.end();
|
||||||
for (it = rectlist.begin(); it != end; ++it) {
|
for (it = rectlist.begin(); it != end; ++it) {
|
||||||
bool snapped = False;
|
bool snapped = False;
|
||||||
|
|
|
@ -37,7 +37,6 @@ extern "C" {
|
||||||
#include "basedisplay.hh"
|
#include "basedisplay.hh"
|
||||||
#include "timer.hh"
|
#include "timer.hh"
|
||||||
#include "util.hh"
|
#include "util.hh"
|
||||||
#include "windowmenu.hh"
|
|
||||||
|
|
||||||
#define MwmHintsFunctions (1l << 0)
|
#define MwmHintsFunctions (1l << 0)
|
||||||
#define MwmHintsDecorations (1l << 1)
|
#define MwmHintsDecorations (1l << 1)
|
||||||
|
@ -130,7 +129,6 @@ private:
|
||||||
BlackboxAttributes blackbox_attrib;
|
BlackboxAttributes blackbox_attrib;
|
||||||
|
|
||||||
Time lastButtonPressTime; // used for double clicks, when were we clicked
|
Time lastButtonPressTime; // used for double clicks, when were we clicked
|
||||||
Windowmenu *windowmenu;
|
|
||||||
|
|
||||||
unsigned int window_number;
|
unsigned int window_number;
|
||||||
unsigned long current_state;
|
unsigned long current_state;
|
||||||
|
@ -290,11 +288,11 @@ private:
|
||||||
void redrawWindowFrame(void) const;
|
void redrawWindowFrame(void) const;
|
||||||
void redrawLabel(void) const;
|
void redrawLabel(void) const;
|
||||||
void redrawAllButtons(void) const;
|
void redrawAllButtons(void) const;
|
||||||
void BlackboxWindow::redrawButton(bool pressed, Window win,
|
void redrawButton(bool pressed, Window win,
|
||||||
Pixmap fppix, unsigned long fppixel,
|
Pixmap fppix, unsigned long fppixel,
|
||||||
Pixmap uppix, unsigned long uppixel,
|
Pixmap uppix, unsigned long uppixel,
|
||||||
Pixmap fpix, unsigned long fpixel,
|
Pixmap fpix, unsigned long fpixel,
|
||||||
Pixmap upix, unsigned long upixel) const;
|
Pixmap upix, unsigned long upixel) const;
|
||||||
void redrawCloseButton(bool pressed) const;
|
void redrawCloseButton(bool pressed) const;
|
||||||
void redrawIconifyButton(bool pressed) const;
|
void redrawIconifyButton(bool pressed) const;
|
||||||
void redrawMaximizeButton(bool pressed) const;
|
void redrawMaximizeButton(bool pressed) const;
|
||||||
|
@ -353,8 +351,6 @@ public:
|
||||||
inline Window getClientWindow(void) const { return client.window; }
|
inline Window getClientWindow(void) const { return client.window; }
|
||||||
inline Window getGroupWindow(void) const { return client.window_group; }
|
inline Window getGroupWindow(void) const { return client.window_group; }
|
||||||
|
|
||||||
inline Windowmenu * getWindowmenu(void) const { return windowmenu; }
|
|
||||||
|
|
||||||
inline const char *getTitle(void) const
|
inline const char *getTitle(void) const
|
||||||
{ return client.title.c_str(); }
|
{ return client.title.c_str(); }
|
||||||
inline const char *getIconTitle(void) const
|
inline const char *getIconTitle(void) const
|
||||||
|
|
|
@ -46,15 +46,11 @@ extern "C" {
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
#include "blackbox.hh"
|
#include "blackbox.hh"
|
||||||
#include "clientmenu.hh"
|
|
||||||
#include "font.hh"
|
#include "font.hh"
|
||||||
#include "netizen.hh"
|
|
||||||
#include "screen.hh"
|
#include "screen.hh"
|
||||||
#include "toolbar.hh"
|
|
||||||
#include "util.hh"
|
#include "util.hh"
|
||||||
#include "window.hh"
|
#include "window.hh"
|
||||||
#include "workspace.hh"
|
#include "workspace.hh"
|
||||||
#include "windowmenu.hh"
|
|
||||||
#include "xatom.hh"
|
#include "xatom.hh"
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,8 +65,6 @@ Workspace::Workspace(BScreen *scrn, unsigned int i) {
|
||||||
|
|
||||||
id = i;
|
id = i;
|
||||||
|
|
||||||
clientmenu = new Clientmenu(this);
|
|
||||||
|
|
||||||
lastfocus = (BlackboxWindow *) 0;
|
lastfocus = (BlackboxWindow *) 0;
|
||||||
|
|
||||||
readName();
|
readName();
|
||||||
|
@ -99,12 +93,6 @@ void Workspace::addWindow(BlackboxWindow *w, bool place, bool sticky) {
|
||||||
|
|
||||||
windowList.push_back(w);
|
windowList.push_back(w);
|
||||||
|
|
||||||
clientmenu->insert(w->getTitle());
|
|
||||||
clientmenu->update();
|
|
||||||
|
|
||||||
if (! sticky)
|
|
||||||
screen->updateNetizenWindowAdd(w->getClientWindow(), id);
|
|
||||||
|
|
||||||
if (screen->doFocusNew() || (w->isTransient() && w->getTransientFor() &&
|
if (screen->doFocusNew() || (w->isTransient() && w->getTransientFor() &&
|
||||||
w->getTransientFor()->isFocused())) {
|
w->getTransientFor()->isFocused())) {
|
||||||
if (id != screen->getCurrentWorkspaceID()) {
|
if (id != screen->getCurrentWorkspaceID()) {
|
||||||
|
@ -146,12 +134,7 @@ void Workspace::removeWindow(BlackboxWindow *w, bool sticky) {
|
||||||
assert(it != end);
|
assert(it != end);
|
||||||
|
|
||||||
windowList.erase(it);
|
windowList.erase(it);
|
||||||
clientmenu->remove(i);
|
|
||||||
clientmenu->update();
|
|
||||||
|
|
||||||
if (! sticky) {
|
if (! sticky) {
|
||||||
screen->updateNetizenWindowDel(w->getClientWindow());
|
|
||||||
|
|
||||||
BlackboxWindowList::iterator it = windowList.begin();
|
BlackboxWindowList::iterator it = windowList.begin();
|
||||||
const BlackboxWindowList::iterator end = windowList.end();
|
const BlackboxWindowList::iterator end = windowList.end();
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
@ -213,19 +196,6 @@ void Workspace::focusFallback(const BlackboxWindow *old_window) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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) {
|
void Workspace::removeAll(void) {
|
||||||
while (! windowList.empty())
|
while (! windowList.empty())
|
||||||
windowList.front()->iconify();
|
windowList.front()->iconify();
|
||||||
|
@ -296,7 +266,6 @@ void Workspace::raiseTransients(const BlackboxWindow * const win,
|
||||||
for (it = win->getTransients().begin(); it != end; ++it) {
|
for (it = win->getTransients().begin(); it != end; ++it) {
|
||||||
BlackboxWindow *w = *it;
|
BlackboxWindow *w = *it;
|
||||||
*stack++ = w->getFrameWindow();
|
*stack++ = w->getFrameWindow();
|
||||||
screen->updateNetizenWindowRaise(w->getClientWindow());
|
|
||||||
|
|
||||||
if (! w->isIconic()) {
|
if (! w->isIconic()) {
|
||||||
Workspace *wkspc = screen->getWorkspace(w->getWorkspaceNumber());
|
Workspace *wkspc = screen->getWorkspace(w->getWorkspaceNumber());
|
||||||
|
@ -325,7 +294,6 @@ void Workspace::lowerTransients(const BlackboxWindow * const win,
|
||||||
for (it = win->getTransients().rbegin(); it != end; ++it) {
|
for (it = win->getTransients().rbegin(); it != end; ++it) {
|
||||||
BlackboxWindow *w = *it;
|
BlackboxWindow *w = *it;
|
||||||
*stack++ = w->getFrameWindow();
|
*stack++ = w->getFrameWindow();
|
||||||
screen->updateNetizenWindowLower(w->getClientWindow());
|
|
||||||
|
|
||||||
if (! w->isIconic()) {
|
if (! w->isIconic()) {
|
||||||
Workspace *wkspc = screen->getWorkspace(w->getWorkspaceNumber());
|
Workspace *wkspc = screen->getWorkspace(w->getWorkspaceNumber());
|
||||||
|
@ -353,7 +321,6 @@ void Workspace::raiseWindow(BlackboxWindow *w) {
|
||||||
StackVector::iterator stack = stack_vector.begin();
|
StackVector::iterator stack = stack_vector.begin();
|
||||||
|
|
||||||
*(stack++) = win->getFrameWindow();
|
*(stack++) = win->getFrameWindow();
|
||||||
screen->updateNetizenWindowRaise(win->getClientWindow());
|
|
||||||
if (! (win->isIconic() || win->isDesktop())) {
|
if (! (win->isIconic() || win->isDesktop())) {
|
||||||
Workspace *wkspc = screen->getWorkspace(win->getWorkspaceNumber());
|
Workspace *wkspc = screen->getWorkspace(win->getWorkspaceNumber());
|
||||||
wkspc->stackingList.remove(win);
|
wkspc->stackingList.remove(win);
|
||||||
|
@ -383,7 +350,6 @@ void Workspace::lowerWindow(BlackboxWindow *w) {
|
||||||
lowerTransients(win, stack);
|
lowerTransients(win, stack);
|
||||||
|
|
||||||
*(stack++) = win->getFrameWindow();
|
*(stack++) = win->getFrameWindow();
|
||||||
screen->updateNetizenWindowLower(win->getClientWindow());
|
|
||||||
if (! (win->isIconic() || win->isDesktop())) {
|
if (! (win->isIconic() || win->isDesktop())) {
|
||||||
Workspace *wkspc = screen->getWorkspace(win->getWorkspaceNumber());
|
Workspace *wkspc = screen->getWorkspace(win->getWorkspaceNumber());
|
||||||
wkspc->stackingList.remove(win);
|
wkspc->stackingList.remove(win);
|
||||||
|
@ -395,7 +361,6 @@ void Workspace::lowerWindow(BlackboxWindow *w) {
|
||||||
|
|
||||||
|
|
||||||
void Workspace::reconfigure(void) {
|
void Workspace::reconfigure(void) {
|
||||||
clientmenu->reconfigure();
|
|
||||||
std::for_each(windowList.begin(), windowList.end(),
|
std::for_each(windowList.begin(), windowList.end(),
|
||||||
std::mem_fun(&BlackboxWindow::reconfigure));
|
std::mem_fun(&BlackboxWindow::reconfigure));
|
||||||
}
|
}
|
||||||
|
@ -445,14 +410,6 @@ BlackboxWindow* Workspace::getTopWindowOnStack(void) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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 {
|
unsigned int Workspace::getCount(void) const {
|
||||||
return windowList.size();
|
return windowList.size();
|
||||||
}
|
}
|
||||||
|
@ -494,16 +451,13 @@ void Workspace::readName(void) {
|
||||||
namesList.size() > id) {
|
namesList.size() > id) {
|
||||||
name = namesList[id];
|
name = namesList[id];
|
||||||
|
|
||||||
clientmenu->setLabel(name);
|
|
||||||
clientmenu->update();
|
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
Use a default name. This doesn't actually change the class. That will
|
Use a default name. This doesn't actually change the class. That will
|
||||||
happen after the setName changes the root property, and that change
|
happen after the setName changes the root property, and that change
|
||||||
makes its way back to this function.
|
makes its way back to this function.
|
||||||
*/
|
*/
|
||||||
string tmp =i18n(WorkspaceSet, WorkspaceDefaultNameFormat,
|
string tmp = "Workspace %d";
|
||||||
"Workspace %d");
|
|
||||||
assert(tmp.length() < 32);
|
assert(tmp.length() < 32);
|
||||||
char default_name[32];
|
char default_name[32];
|
||||||
sprintf(default_name, tmp.c_str(), id + 1);
|
sprintf(default_name, tmp.c_str(), id + 1);
|
||||||
|
|
|
@ -32,11 +32,11 @@ extern "C" {
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "xatom.hh"
|
||||||
|
|
||||||
class BScreen;
|
class BScreen;
|
||||||
class Clientmenu;
|
|
||||||
class Workspace;
|
class Workspace;
|
||||||
class BlackboxWindow;
|
class BlackboxWindow;
|
||||||
class Netizen;
|
|
||||||
|
|
||||||
typedef std::list<BlackboxWindow*> BlackboxWindowList;
|
typedef std::list<BlackboxWindow*> BlackboxWindowList;
|
||||||
typedef std::vector<Window> StackVector;
|
typedef std::vector<Window> StackVector;
|
||||||
|
@ -45,7 +45,6 @@ class Workspace {
|
||||||
private:
|
private:
|
||||||
BScreen *screen;
|
BScreen *screen;
|
||||||
BlackboxWindow *lastfocus;
|
BlackboxWindow *lastfocus;
|
||||||
Clientmenu *clientmenu;
|
|
||||||
XAtom *xatom;
|
XAtom *xatom;
|
||||||
|
|
||||||
BlackboxWindowList stackingList, windowList;
|
BlackboxWindowList stackingList, windowList;
|
||||||
|
@ -80,8 +79,6 @@ public:
|
||||||
|
|
||||||
inline BlackboxWindow *getLastFocusedWindow(void) { return lastfocus; }
|
inline BlackboxWindow *getLastFocusedWindow(void) { return lastfocus; }
|
||||||
|
|
||||||
inline Clientmenu *getMenu(void) { return clientmenu; }
|
|
||||||
|
|
||||||
inline const std::string& getName(void) const { return name; }
|
inline const std::string& getName(void) const { return name; }
|
||||||
|
|
||||||
inline unsigned int getID(void) const { return id; }
|
inline unsigned int getID(void) const { return id; }
|
||||||
|
@ -95,9 +92,7 @@ public:
|
||||||
BlackboxWindow* getNextWindowInList(BlackboxWindow *w);
|
BlackboxWindow* getNextWindowInList(BlackboxWindow *w);
|
||||||
BlackboxWindow* getPrevWindowInList(BlackboxWindow *w);
|
BlackboxWindow* getPrevWindowInList(BlackboxWindow *w);
|
||||||
BlackboxWindow* getTopWindowOnStack(void) const;
|
BlackboxWindow* getTopWindowOnStack(void) const;
|
||||||
void sendWindowList(Netizen &n);
|
|
||||||
void focusFallback(const BlackboxWindow *old_window);
|
void focusFallback(const BlackboxWindow *old_window);
|
||||||
void setFocused(const BlackboxWindow *w, bool focused);
|
|
||||||
|
|
||||||
bool isCurrent(void) const;
|
bool isCurrent(void) const;
|
||||||
bool isLastWindow(const BlackboxWindow* w) const;
|
bool isLastWindow(const BlackboxWindow* w) const;
|
||||||
|
|
Loading…
Reference in a new issue