From 7bf96a9123a9f6b29a4c6168f7391db72f374f8a Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Thu, 31 Oct 2002 08:42:45 +0000 Subject: [PATCH] compiles now. uses xft2 remove the nls remainders --- Makefile.am | 2 +- nls/.cvsignore | 3 - nls/C/.cvsignore | 4 - nls/da_DK/.cvsignore | 4 - nls/de_DE/.cvsignore | 4 - nls/es_AR/.cvsignore | 4 - nls/es_ES/.cvsignore | 4 - nls/et_EE/.cvsignore | 4 - nls/fr_FR/.cvsignore | 4 - nls/hu_HU/.cvsignore | 4 - nls/it_IT/.cvsignore | 4 - nls/ja_JP/.cvsignore | 4 - nls/ko_KR/.cvsignore | 4 - nls/lv_LV/.cvsignore | 2 - nls/nl_NL/.cvsignore | 4 - nls/no_NO/.cvsignore | 4 - nls/pl_PL/.cvsignore | 4 - nls/pt_BR/.cvsignore | 4 - nls/ro_RO/.cvsignore | 4 - nls/ru_RU/.cvsignore | 4 - nls/sk_SK/.cvsignore | 4 - nls/sl_SI/.cvsignore | 4 - nls/sv_SE/.cvsignore | 4 - nls/tr_TR/.cvsignore | 4 - nls/uk_UA/.cvsignore | 4 - nls/zh_CN/.cvsignore | 4 - nls/zh_TW/.cvsignore | 4 - src/Makefile.am | 132 +----- src/basedisplay.cc | 73 +--- src/blackbox.cc | 242 +---------- src/blackbox.hh | 48 +-- src/font.cc | 293 ++----------- src/font.hh | 22 +- src/image.cc | 12 +- src/image.hh | 2 - src/imagecontrol.cc | 44 +- src/main.cc | 74 ++-- src/screen.cc | 997 +------------------------------------------ src/screen.hh | 108 +---- src/window.cc | 109 +---- src/window.hh | 14 +- src/workspace.cc | 48 +-- src/workspace.hh | 9 +- 43 files changed, 139 insertions(+), 2191 deletions(-) delete mode 100644 nls/.cvsignore delete mode 100644 nls/C/.cvsignore delete mode 100644 nls/da_DK/.cvsignore delete mode 100644 nls/de_DE/.cvsignore delete mode 100644 nls/es_AR/.cvsignore delete mode 100644 nls/es_ES/.cvsignore delete mode 100644 nls/et_EE/.cvsignore delete mode 100644 nls/fr_FR/.cvsignore delete mode 100644 nls/hu_HU/.cvsignore delete mode 100644 nls/it_IT/.cvsignore delete mode 100644 nls/ja_JP/.cvsignore delete mode 100644 nls/ko_KR/.cvsignore delete mode 100644 nls/lv_LV/.cvsignore delete mode 100644 nls/nl_NL/.cvsignore delete mode 100644 nls/no_NO/.cvsignore delete mode 100644 nls/pl_PL/.cvsignore delete mode 100644 nls/pt_BR/.cvsignore delete mode 100644 nls/ro_RO/.cvsignore delete mode 100644 nls/ru_RU/.cvsignore delete mode 100644 nls/sk_SK/.cvsignore delete mode 100644 nls/sl_SI/.cvsignore delete mode 100644 nls/sv_SE/.cvsignore delete mode 100644 nls/tr_TR/.cvsignore delete mode 100644 nls/uk_UA/.cvsignore delete mode 100644 nls/zh_CN/.cvsignore delete mode 100644 nls/zh_TW/.cvsignore diff --git a/Makefile.am b/Makefile.am index f5e5b972..cdad429f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ # Makefile.am for Openbox -SUBDIRS = data doc nls src util +SUBDIRS = data doc src util MAINTAINERCLEANFILES = aclocal.m4 config.h.in configure Makefile.in stamp-h.in uninstall-local: diff --git a/nls/.cvsignore b/nls/.cvsignore deleted file mode 100644 index 4ad11e15..00000000 --- a/nls/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -Makefile -Makefile.in -blackbox-nls.hh diff --git a/nls/C/.cvsignore b/nls/C/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/C/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/nls/da_DK/.cvsignore b/nls/da_DK/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/da_DK/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/nls/de_DE/.cvsignore b/nls/de_DE/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/de_DE/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/nls/es_AR/.cvsignore b/nls/es_AR/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/es_AR/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/nls/es_ES/.cvsignore b/nls/es_ES/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/es_ES/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/nls/et_EE/.cvsignore b/nls/et_EE/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/et_EE/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/nls/fr_FR/.cvsignore b/nls/fr_FR/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/fr_FR/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/nls/hu_HU/.cvsignore b/nls/hu_HU/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/hu_HU/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/nls/it_IT/.cvsignore b/nls/it_IT/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/it_IT/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/nls/ja_JP/.cvsignore b/nls/ja_JP/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/ja_JP/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/nls/ko_KR/.cvsignore b/nls/ko_KR/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/ko_KR/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/nls/lv_LV/.cvsignore b/nls/lv_LV/.cvsignore deleted file mode 100644 index 282522db..00000000 --- a/nls/lv_LV/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/nls/nl_NL/.cvsignore b/nls/nl_NL/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/nl_NL/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/nls/no_NO/.cvsignore b/nls/no_NO/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/no_NO/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/nls/pl_PL/.cvsignore b/nls/pl_PL/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/pl_PL/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/nls/pt_BR/.cvsignore b/nls/pt_BR/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/pt_BR/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/nls/ro_RO/.cvsignore b/nls/ro_RO/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/ro_RO/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/nls/ru_RU/.cvsignore b/nls/ru_RU/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/ru_RU/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/nls/sk_SK/.cvsignore b/nls/sk_SK/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/sk_SK/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/nls/sl_SI/.cvsignore b/nls/sl_SI/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/sl_SI/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/nls/sv_SE/.cvsignore b/nls/sv_SE/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/sv_SE/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/nls/tr_TR/.cvsignore b/nls/tr_TR/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/tr_TR/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/nls/uk_UA/.cvsignore b/nls/uk_UA/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/uk_UA/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/nls/zh_CN/.cvsignore b/nls/zh_CN/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/zh_CN/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/nls/zh_TW/.cvsignore b/nls/zh_TW/.cvsignore deleted file mode 100644 index 5f2f9cf5..00000000 --- a/nls/zh_TW/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile -Makefile.in -Translation.m -openbox.cat diff --git a/src/Makefile.am b/src/Makefile.am index f0f77bb9..f0a7ca7d 100644 --- a/src/Makefile.am +++ b/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_STYLE=$(pkgdatadir)/styles/mbdtex -CPPFLAGS=@CPPFLAGS@ @DEBUG@ \ --DLOCALEPATH=\"$(pkgdatadir)/nls\" \ +CXXFLAGS=`pkg-config --cflags xft` @CXXFLAGS@ \ -DDEFAULTMENU=\"$(DEFAULT_MENU)\" \ --DDEFAULTSTYLE=\"$(DEFAULT_STYLE)\" +-DDEFAULTSTYLE=\"$(DEFAULT_STYLE)\" \ +-Dmultibyte\(\)=True + +LDFLAGS=`pkg-config --libs xft` bin_PROGRAMS= openbox -openbox_SOURCES= BaseDisplay.cc Basemenu.cc Clientmenu.cc Color.cc Configmenu.cc Configuration.cc Font.cc GCCache.cc Iconmenu.cc Image.cc ImageControl.cc Netizen.cc Rootmenu.cc Screen.cc Slit.cc Texture.cc Timer.cc Toolbar.cc Util.cc Window.cc Windowmenu.cc Workspace.cc Workspacemenu.cc XAtom.cc blackbox.cc i18n.cc main.cc +openbox_SOURCES= basedisplay.cc color.cc configuration.cc font.cc gccache.cc image.cc imagecontrol.cc screen.cc texture.cc timer.cc util.cc window.cc workspace.cc xatom.cc blackbox.cc main.cc MAINTAINERCLEANFILES= Makefile.in @@ -37,104 +18,3 @@ distclean-local: rm -f *\~ *.orig *.rej .\#* # local dependencies - -BaseDisplay.o: BaseDisplay.cc i18n.hh ../nls/blackbox-nls.hh \ - BaseDisplay.hh Timer.hh Util.hh GCCache.hh Color.hh -Basemenu.o: Basemenu.cc i18n.hh ../nls/blackbox-nls.hh blackbox.hh \ - BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh Basemenu.hh \ - Font.hh Screen.hh Color.hh Texture.hh Image.hh Configmenu.hh \ - Iconmenu.hh Netizen.hh Rootmenu.hh Workspace.hh Workspacemenu.hh \ - GCCache.hh -Clientmenu.o: Clientmenu.cc blackbox.hh i18n.hh ../nls/blackbox-nls.hh \ - BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh \ - Clientmenu.hh Basemenu.hh Screen.hh Color.hh Texture.hh Image.hh \ - Configmenu.hh Iconmenu.hh Netizen.hh Rootmenu.hh Workspace.hh \ - Workspacemenu.hh Window.hh Windowmenu.hh -Color.o: Color.cc Color.hh BaseDisplay.hh Timer.hh Util.hh -Configmenu.o: Configmenu.cc i18n.hh ../nls/blackbox-nls.hh \ - Configmenu.hh Basemenu.hh Image.hh Timer.hh BaseDisplay.hh Util.hh \ - Color.hh Toolbar.hh Screen.hh Texture.hh Iconmenu.hh Netizen.hh \ - Rootmenu.hh Workspace.hh Workspacemenu.hh blackbox.hh \ - Configuration.hh XAtom.hh Window.hh Windowmenu.hh -Configuration.o: Configuration.cc ../config.h Configuration.hh Util.hh -Font.o: Font.cc i18n.hh ../nls/blackbox-nls.hh Font.hh Screen.hh \ - Color.hh Texture.hh Util.hh Image.hh Timer.hh BaseDisplay.hh \ - Configmenu.hh Basemenu.hh Iconmenu.hh Netizen.hh Rootmenu.hh \ - Workspace.hh Workspacemenu.hh blackbox.hh Configuration.hh XAtom.hh \ - GCCache.hh -GCCache.o: GCCache.cc GCCache.hh BaseDisplay.hh Timer.hh Util.hh \ - Color.hh -Iconmenu.o: Iconmenu.cc i18n.hh ../nls/blackbox-nls.hh Iconmenu.hh \ - Basemenu.hh Screen.hh Color.hh Texture.hh Util.hh Image.hh Timer.hh \ - BaseDisplay.hh Configmenu.hh Netizen.hh Rootmenu.hh Workspace.hh \ - Workspacemenu.hh blackbox.hh Configuration.hh XAtom.hh Window.hh \ - Windowmenu.hh -Image.o: Image.cc blackbox.hh i18n.hh ../nls/blackbox-nls.hh \ - BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh GCCache.hh \ - Color.hh Image.hh Texture.hh -ImageControl.o: ImageControl.cc blackbox.hh i18n.hh \ - ../nls/blackbox-nls.hh BaseDisplay.hh Timer.hh Util.hh \ - Configuration.hh XAtom.hh Color.hh Image.hh Texture.hh -Netizen.o: Netizen.cc Netizen.hh Screen.hh Color.hh Texture.hh Util.hh \ - Image.hh Timer.hh BaseDisplay.hh Configmenu.hh Basemenu.hh \ - Iconmenu.hh Rootmenu.hh Workspace.hh Workspacemenu.hh blackbox.hh \ - i18n.hh ../nls/blackbox-nls.hh Configuration.hh XAtom.hh -Rootmenu.o: Rootmenu.cc blackbox.hh i18n.hh ../nls/blackbox-nls.hh \ - BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh Rootmenu.hh \ - Basemenu.hh Screen.hh Color.hh Texture.hh Image.hh Configmenu.hh \ - Iconmenu.hh Netizen.hh Workspace.hh Workspacemenu.hh -Screen.o: Screen.cc ../config.h i18n.hh ../nls/blackbox-nls.hh \ - blackbox.hh BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh \ - Clientmenu.hh Basemenu.hh Font.hh Screen.hh Color.hh Texture.hh \ - Image.hh Configmenu.hh Iconmenu.hh Netizen.hh Rootmenu.hh \ - Workspace.hh Workspacemenu.hh GCCache.hh Slit.hh Toolbar.hh Window.hh \ - Windowmenu.hh -Slit.o: Slit.cc i18n.hh ../nls/blackbox-nls.hh blackbox.hh \ - BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh Image.hh \ - Color.hh Screen.hh Texture.hh Configmenu.hh Basemenu.hh Iconmenu.hh \ - Netizen.hh Rootmenu.hh Workspace.hh Workspacemenu.hh Slit.hh \ - Toolbar.hh -Texture.o: Texture.cc Texture.hh Color.hh Util.hh BaseDisplay.hh \ - Timer.hh Image.hh Screen.hh Configmenu.hh Basemenu.hh Iconmenu.hh \ - Netizen.hh Rootmenu.hh Workspace.hh Workspacemenu.hh blackbox.hh \ - i18n.hh ../nls/blackbox-nls.hh Configuration.hh XAtom.hh -Timer.o: Timer.cc BaseDisplay.hh Timer.hh Util.hh -Toolbar.o: Toolbar.cc i18n.hh ../nls/blackbox-nls.hh blackbox.hh \ - BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh \ - Clientmenu.hh Basemenu.hh Font.hh Screen.hh Color.hh Texture.hh \ - Image.hh Configmenu.hh Iconmenu.hh Netizen.hh Rootmenu.hh \ - Workspace.hh Workspacemenu.hh GCCache.hh Toolbar.hh Window.hh \ - Windowmenu.hh Slit.hh -Util.o: Util.cc Util.hh -Window.o: Window.cc i18n.hh ../nls/blackbox-nls.hh blackbox.hh \ - BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh Font.hh \ - Screen.hh Color.hh Texture.hh Image.hh Configmenu.hh Basemenu.hh \ - Iconmenu.hh Netizen.hh Rootmenu.hh Workspace.hh Workspacemenu.hh \ - GCCache.hh Toolbar.hh Window.hh Windowmenu.hh Slit.hh -Windowmenu.o: Windowmenu.cc i18n.hh ../nls/blackbox-nls.hh blackbox.hh \ - BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh Screen.hh \ - Color.hh Texture.hh Image.hh Configmenu.hh Basemenu.hh Iconmenu.hh \ - Netizen.hh Rootmenu.hh Workspace.hh Workspacemenu.hh Window.hh \ - Windowmenu.hh -Workspace.o: Workspace.cc i18n.hh ../nls/blackbox-nls.hh blackbox.hh \ - BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh \ - Clientmenu.hh Basemenu.hh Netizen.hh Screen.hh Color.hh Texture.hh \ - Image.hh Configmenu.hh Iconmenu.hh Rootmenu.hh Workspace.hh \ - Workspacemenu.hh Toolbar.hh Window.hh Windowmenu.hh -Workspacemenu.o: Workspacemenu.cc i18n.hh ../nls/blackbox-nls.hh \ - blackbox.hh BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh \ - Screen.hh Color.hh Texture.hh Image.hh Configmenu.hh Basemenu.hh \ - Iconmenu.hh Netizen.hh Rootmenu.hh Workspace.hh Workspacemenu.hh \ - Toolbar.hh -XAtom.o: XAtom.cc ../config.h XAtom.hh Screen.hh Color.hh Texture.hh \ - Util.hh Image.hh Timer.hh BaseDisplay.hh Configmenu.hh Basemenu.hh \ - Iconmenu.hh Netizen.hh Rootmenu.hh Workspace.hh Workspacemenu.hh \ - blackbox.hh i18n.hh ../nls/blackbox-nls.hh Configuration.hh -blackbox.o: blackbox.cc i18n.hh ../nls/blackbox-nls.hh blackbox.hh \ - BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh Basemenu.hh \ - Clientmenu.hh GCCache.hh Color.hh Image.hh Rootmenu.hh Screen.hh \ - Texture.hh Configmenu.hh Iconmenu.hh Netizen.hh Workspace.hh \ - Workspacemenu.hh Slit.hh Toolbar.hh Window.hh Windowmenu.hh -i18n.o: i18n.cc i18n.hh ../nls/blackbox-nls.hh -main.o: main.cc ../version.h i18n.hh ../nls/blackbox-nls.hh \ - blackbox.hh BaseDisplay.hh Timer.hh Util.hh Configuration.hh XAtom.hh diff --git a/src/basedisplay.cc b/src/basedisplay.cc index 65574d65..72b0dbb0 100644 --- a/src/basedisplay.cc +++ b/src/basedisplay.cc @@ -1,25 +1,4 @@ // -*- mode: C++; indent-tabs-mode: nil; -*- -// BaseDisplay.cc for Blackbox - an X11 Window manager -// Copyright (c) 2001 - 2002 Sean 'Shaleh' Perry -// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. #ifdef HAVE_CONFIG_H # include "../config.h" @@ -102,9 +81,7 @@ static int handleXErrors(Display *d, XErrorEvent *e) { char errtxt[128]; XGetErrorText(d, e->error_code, errtxt, 128); - fprintf(stderr, - i18n(BaseDisplaySet, BaseDisplayXError, - "%s: X error: %s(%d) opcodes %d/%d\n resource 0x%lx\n"), + fprintf(stderr, "%s: X error: %s(%d) opcodes %d/%d\n resource 0x%lx\n", base_display->getApplicationName(), errtxt, e->error_code, e->request_code, e->minor_code, e->resourceid); #else @@ -121,11 +98,7 @@ static int handleXErrors(Display *d, XErrorEvent *e) { // signal handler to allow for proper and gentle shutdown -#ifndef HAVE_SIGACTION -static RETSIGTYPE signalhandler(int sig) { -#else // HAVE_SIGACTION static void signalhandler(int sig) { -#endif // HAVE_SIGACTION static int re_enter = 0; @@ -133,41 +106,25 @@ static void signalhandler(int sig) { case SIGCHLD: int status; waitpid(-1, &status, WNOHANG | WUNTRACED); - -#ifndef HAVE_SIGACTION - // assume broken, braindead sysv signal semantics - signal(SIGCHLD, (RETSIGTYPE (*)(int)) signalhandler); -#endif // HAVE_SIGACTION - break; default: - if (base_display->handleSignal(sig)) { - -#ifndef HAVE_SIGACTION - // assume broken, braindead sysv signal semantics - signal(sig, (RETSIGTYPE (*)(int)) signalhandler); -#endif // HAVE_SIGACTION - + if (base_display->handleSignal(sig)) return; - } - fprintf(stderr, i18n(BaseDisplaySet, BaseDisplaySignalCaught, - "%s: signal %d caught\n"), + fprintf(stderr, "%s: signal %d caught\n", base_display->getApplicationName(), sig); if (! base_display->isStartup() && ! re_enter) { internal_error = True; re_enter = 1; - fprintf(stderr, i18n(BaseDisplaySet, BaseDisplayShuttingDown, - "shutting down\n")); + fprintf(stderr, "shutting down\n"); base_display->shutdown(); } if (sig != SIGTERM && sig != SIGINT) { - fprintf(stderr, i18n(BaseDisplaySet, BaseDisplayAborting, - "aborting... dumping core\n")); + fprintf(stderr, "aborting... dumping core\n"); abort(); } @@ -185,7 +142,6 @@ BaseDisplay::BaseDisplay(const char *app_name, const char *dpy_name) { ::base_display = this; -#ifdef HAVE_SIGACTION struct sigaction action; action.sa_handler = signalhandler; @@ -201,28 +157,15 @@ BaseDisplay::BaseDisplay(const char *app_name, const char *dpy_name) { sigaction(SIGHUP, &action, NULL); sigaction(SIGUSR1, &action, NULL); sigaction(SIGUSR2, &action, NULL); -#else // !HAVE_SIGACTION - signal(SIGPIPE, (RETSIGTYPE (*)(int)) signalhandler); - signal(SIGSEGV, (RETSIGTYPE (*)(int)) signalhandler); - signal(SIGFPE, (RETSIGTYPE (*)(int)) signalhandler); - signal(SIGTERM, (RETSIGTYPE (*)(int)) signalhandler); - signal(SIGINT, (RETSIGTYPE (*)(int)) signalhandler); - signal(SIGUSR1, (RETSIGTYPE (*)(int)) signalhandler); - signal(SIGUSR2, (RETSIGTYPE (*)(int)) signalhandler); - signal(SIGHUP, (RETSIGTYPE (*)(int)) signalhandler); - signal(SIGCHLD, (RETSIGTYPE (*)(int)) signalhandler); -#endif // HAVE_SIGACTION if (! (display = XOpenDisplay(dpy_name))) { fprintf(stderr, - i18n(BaseDisplaySet, BaseDisplayXConnectFail, - "BaseDisplay::BaseDisplay: connection to X server failed.\n")); + "BaseDisplay::BaseDisplay: connection to X server failed.\n"); ::exit(2); } else if (fcntl(ConnectionNumber(display), F_SETFD, 1) == -1) { fprintf(stderr, - i18n(BaseDisplaySet, BaseDisplayCloseOnExecFail, - "BaseDisplay::BaseDisplay: couldn't mark display connection " - "as close-on-exec\n")); + "BaseDisplay::BaseDisplay: couldn't mark display connection " + "as close-on-exec\n"); ::exit(2); } diff --git a/src/blackbox.cc b/src/blackbox.cc index 63e0ef05..e0240e81 100644 --- a/src/blackbox.cc +++ b/src/blackbox.cc @@ -97,24 +97,18 @@ extern "C" { using std::string; #include "blackbox.hh" -#include "basemenu.hh" -#include "clientmenu.hh" #include "gccache.hh" #include "image.hh" -#include "rootmenu.hh" #include "screen.hh" -#include "slit.hh" -#include "toolbar.hh" #include "util.hh" #include "window.hh" #include "workspace.hh" -#include "workspacemenu.hh" #include "xatom.hh" Blackbox *blackbox; -Blackbox::Blackbox(char **m_argv, char *dpy_name, char *rc, char *menu) +Blackbox::Blackbox(char **m_argv, char *dpy_name, char *rc) : BaseDisplay(m_argv[0], dpy_name) { if (! XSupportsLocale()) fprintf(stderr, "X server does not support locale\n"); @@ -134,17 +128,6 @@ Blackbox::Blackbox(char **m_argv, char *dpy_name, char *rc, char *menu) rc_file = expandTilde(rc); config.setFile(rc_file); - string rcmenu; - if (! menu) { - //have to come up with something better than this - config.load(); - if (! config.getValue("session.menuFile", rcmenu)) - rcmenu = "~/.openbox/menu"; - } else { - rcmenu = menu; - } - menu_file = expandTilde(rcmenu.c_str()); - no_focus = False; resource.auto_raise_delay.tv_sec = resource.auto_raise_delay.tv_usec = 0; @@ -176,8 +159,7 @@ Blackbox::Blackbox(char **m_argv, char *dpy_name, char *rc, char *menu) if (screenList.empty()) { fprintf(stderr, - i18n(blackboxSet, blackboxNoManagableScreens, - "Blackbox::Blackbox: no managable screens found, aborting.\n")); + "Blackbox::Blackbox: no managable screens found, aborting.\n"); ::exit(3); } @@ -191,7 +173,7 @@ Blackbox::Blackbox(char **m_argv, char *dpy_name, char *rc, char *menu) XSynchronize(getXDisplay(), False); XSync(getXDisplay(), False); - reconfigure_wait = reread_menu_wait = False; + reconfigure_wait = False; timer = new BTimer(this, this); timer->setTimeout(0l); @@ -201,9 +183,6 @@ Blackbox::Blackbox(char **m_argv, char *dpy_name, char *rc, char *menu) Blackbox::~Blackbox(void) { std::for_each(screenList.begin(), screenList.end(), PointerAssassin()); - std::for_each(menuTimestamps.begin(), menuTimestamps.end(), - PointerAssassin()); - delete xatom; delete timer; @@ -219,9 +198,6 @@ void Blackbox::process_event(XEvent *e) { last_time = e->xbutton.time; BlackboxWindow *win = (BlackboxWindow *) 0; - Basemenu *menu = (Basemenu *) 0; - Slit *slit = (Slit *) 0; - Toolbar *tbar = (Toolbar *) 0; BScreen *scrn = (BScreen *) 0; if ((win = searchWindow(e->xbutton.window))) { @@ -230,12 +206,6 @@ void Blackbox::process_event(XEvent *e) { /* XXX: is this sane on low colour desktops? */ if (e->xbutton.button == 1) win->installColormap(True); - } else if ((menu = searchMenu(e->xbutton.window))) { - menu->buttonPressEvent(&e->xbutton); - } else if ((slit = searchSlit(e->xbutton.window))) { - slit->buttonPressEvent(&e->xbutton); - } else if ((tbar = searchToolbar(e->xbutton.window))) { - tbar->buttonPressEvent(&e->xbutton); } else if ((scrn = searchScreen(e->xbutton.window))) { scrn->buttonPressEvent(&e->xbutton); if (active_screen != scrn) { @@ -256,27 +226,18 @@ void Blackbox::process_event(XEvent *e) { last_time = e->xbutton.time; BlackboxWindow *win = (BlackboxWindow *) 0; - Basemenu *menu = (Basemenu *) 0; - Toolbar *tbar = (Toolbar *) 0; if ((win = searchWindow(e->xbutton.window))) win->buttonReleaseEvent(&e->xbutton); - else if ((menu = searchMenu(e->xbutton.window))) - menu->buttonReleaseEvent(&e->xbutton); - else if ((tbar = searchToolbar(e->xbutton.window))) - tbar->buttonReleaseEvent(&e->xbutton); break; } case ConfigureRequest: { BlackboxWindow *win = (BlackboxWindow *) 0; - Slit *slit = (Slit *) 0; if ((win = searchWindow(e->xconfigurerequest.window))) { win->configureRequestEvent(&e->xconfigurerequest); - } else if ((slit = searchSlit(e->xconfigurerequest.window))) { - slit->configureRequestEvent(&e->xconfigurerequest); } else { if (validateWindow(e->xconfigurerequest.window)) { XWindowChanges xwc; @@ -354,13 +315,10 @@ void Blackbox::process_event(XEvent *e) { case UnmapNotify: { BlackboxWindow *win = (BlackboxWindow *) 0; - Slit *slit = (Slit *) 0; BScreen *screen = (BScreen *) 0; if ((win = searchWindow(e->xunmap.window))) { win->unmapNotifyEvent(&e->xunmap); - } else if ((slit = searchSlit(e->xunmap.window))) { - slit->unmapNotifyEvent(&e->xunmap); } else if ((screen = searchSystrayWindow(e->xunmap.window))) { screen->removeSystrayWindow(e->xunmap.window); } @@ -370,14 +328,11 @@ void Blackbox::process_event(XEvent *e) { case DestroyNotify: { BlackboxWindow *win = (BlackboxWindow *) 0; - Slit *slit = (Slit *) 0; BScreen *screen = (BScreen *) 0; BWindowGroup *group = (BWindowGroup *) 0; if ((win = searchWindow(e->xdestroywindow.window))) { win->destroyNotifyEvent(&e->xdestroywindow); - } else if ((slit = searchSlit(e->xdestroywindow.window))) { - slit->removeClient(e->xdestroywindow.window, False); } else if ((group = searchGroup(e->xdestroywindow.window))) { delete group; } else if ((screen = searchSystrayWindow(e->xunmap.window))) { @@ -395,13 +350,8 @@ void Blackbox::process_event(XEvent *e) { to an already unmapped window. */ BlackboxWindow *win = searchWindow(e->xreparent.window); - if (win) { + if (win) win->reparentNotifyEvent(&e->xreparent); - } else { - Slit *slit = searchSlit(e->xreparent.window); - if (slit && slit->getWindowID() != e->xreparent.parent) - slit->removeClient(e->xreparent.window, True); - } break; } @@ -428,12 +378,9 @@ void Blackbox::process_event(XEvent *e) { last_time = e->xmotion.time; BlackboxWindow *win = (BlackboxWindow *) 0; - Basemenu *menu = (Basemenu *) 0; if ((win = searchWindow(e->xmotion.window))) win->motionNotifyEvent(&e->xmotion); - else if ((menu = searchMenu(e->xmotion.window))) - menu->motionNotifyEvent(&e->xmotion); break; } @@ -456,9 +403,6 @@ void Blackbox::process_event(XEvent *e) { BScreen *screen = (BScreen *) 0; BlackboxWindow *win = (BlackboxWindow *) 0; - Basemenu *menu = (Basemenu *) 0; - Toolbar *tbar = (Toolbar *) 0; - Slit *slit = (Slit *) 0; if (e->xcrossing.mode == NotifyGrab) break; @@ -468,12 +412,6 @@ void Blackbox::process_event(XEvent *e) { } else if ((win = searchWindow(e->xcrossing.window))) { if (! no_focus) win->enterNotifyEvent(&e->xcrossing); - } else if ((menu = searchMenu(e->xcrossing.window))) { - menu->enterNotifyEvent(&e->xcrossing); - } else if ((tbar = searchToolbar(e->xcrossing.window))) { - tbar->enterNotifyEvent(&e->xcrossing); - } else if ((slit = searchSlit(e->xcrossing.window))) { - slit->enterNotifyEvent(&e->xcrossing); } break; } @@ -482,18 +420,9 @@ void Blackbox::process_event(XEvent *e) { last_time = e->xcrossing.time; BlackboxWindow *win = (BlackboxWindow *) 0; - Basemenu *menu = (Basemenu *) 0; - Toolbar *tbar = (Toolbar *) 0; - Slit *slit = (Slit *) 0; - if ((menu = searchMenu(e->xcrossing.window))) - menu->leaveNotifyEvent(&e->xcrossing); - else if ((win = searchWindow(e->xcrossing.window))) + if ((win = searchWindow(e->xcrossing.window))) win->leaveNotifyEvent(&e->xcrossing); - else if ((tbar = searchToolbar(e->xcrossing.window))) - tbar->leaveNotifyEvent(&e->xcrossing); - else if ((slit = searchSlit(e->xcrossing.window))) - slit->leaveNotifyEvent(&e->xcrossing); break; } @@ -526,25 +455,14 @@ void Blackbox::process_event(XEvent *e) { e->xexpose.height = ey2 - ey1 + 1; BlackboxWindow *win = (BlackboxWindow *) 0; - Basemenu *menu = (Basemenu *) 0; - Toolbar *tbar = (Toolbar *) 0; if ((win = searchWindow(e->xexpose.window))) win->exposeEvent(&e->xexpose); - else if ((menu = searchMenu(e->xexpose.window))) - menu->exposeEvent(&e->xexpose); - else if ((tbar = searchToolbar(e->xexpose.window))) - tbar->exposeEvent(&e->xexpose); break; } case KeyPress: { - Toolbar *tbar = searchToolbar(e->xkey.window); - - if (tbar && tbar->isEditing()) - tbar->keyPressEvent(&e->xkey); - break; } @@ -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; case SIGUSR2: - rereadMenu(); break; 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) { 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) { 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) { shutdown(); @@ -1318,10 +1156,6 @@ void Blackbox::reconfigure(void) { void Blackbox::real_reconfigure(void) { load_rc(); - std::for_each(menuTimestamps.begin(), menuTimestamps.end(), - PointerAssassin()); - menuTimestamps.clear(); - gcCache()->purge(); std::for_each(screenList.begin(), screenList.end(), @@ -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) { assert(! filename.empty()); 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) { if (reconfigure_wait) real_reconfigure(); - if (reread_menu_wait) - real_rereadMenu(); - - reconfigure_wait = reread_menu_wait = False; + reconfigure_wait = False; } @@ -1453,12 +1225,10 @@ void Blackbox::setFocusedWindow(BlackboxWindow *win) { } if (active_screen && active_screen->isScreenManaged()) { - active_screen->getToolbar()->redrawWindowLabel(True); active_screen->updateNetizenWindowFocus(); } if (old_screen && old_screen != active_screen) { - old_screen->getToolbar()->redrawWindowLabel(True); old_screen->updateNetizenWindowFocus(); } } diff --git a/src/blackbox.hh b/src/blackbox.hh index 52e0e653..2d5d5f6d 100644 --- a/src/blackbox.hh +++ b/src/blackbox.hh @@ -88,11 +88,6 @@ class BScreen; class Blackbox; class BlackboxWindow; class BWindowGroup; -class Basemenu; -class Toolbar; -class Slit; - -extern I18n i18n; class Blackbox : public BaseDisplay, public TimeoutHandler { private: @@ -101,11 +96,6 @@ private: }; BCursor cursor; - struct MenuTimestamp { - std::string filename; - time_t timestamp; - }; - struct BResource { Time double_click_interval; @@ -134,21 +124,6 @@ private: typedef GroupLookup::value_type GroupLookupPair; GroupLookup groupSearchList; - typedef std::map MenuLookup; - typedef MenuLookup::value_type MenuLookupPair; - MenuLookup menuSearchList; - - typedef std::map ToolbarLookup; - typedef ToolbarLookup::value_type ToolbarLookupPair; - ToolbarLookup toolbarSearchList; - - typedef std::map SlitLookup; - typedef SlitLookup::value_type SlitLookupPair; - SlitLookup slitSearchList; - - typedef std::list MenuTimestampList; - MenuTimestampList menuTimestamps; - typedef std::list ScreenList; ScreenList screenList; @@ -158,33 +133,29 @@ private: Configuration config; XAtom *xatom; - bool no_focus, reconfigure_wait, reread_menu_wait; + bool no_focus, reconfigure_wait; Time last_time; char **argv; - std::string menu_file, rc_file; + std::string rc_file; Blackbox(const Blackbox&); Blackbox& operator=(const Blackbox&); void load_rc(void); void save_rc(void); - void real_rereadMenu(void); void real_reconfigure(void); virtual void process_event(XEvent *); public: - Blackbox(char **m_argv, char *dpy_name = 0, char *rc = 0, char *menu = 0); + Blackbox(char **m_argv, char *dpy_name = 0, char *rc = 0); virtual ~Blackbox(void); - Basemenu *searchMenu(Window window); BWindowGroup *searchGroup(Window window); BScreen *searchSystrayWindow(Window window); BlackboxWindow *searchWindow(Window window); BScreen *searchScreen(Window window); - Toolbar *searchToolbar(Window); - Slit *searchSlit(Window); #ifdef XINERAMA inline bool doXineramaPlacement(void) const @@ -199,18 +170,12 @@ public: void saveXineramaSnapping(bool x); #endif // XINERAMA - void saveMenuSearch(Window window, Basemenu *data); void saveSystrayWindowSearch(Window window, BScreen *screen); void saveWindowSearch(Window window, BlackboxWindow *data); void saveGroupSearch(Window window, BWindowGroup *data); - void saveToolbarSearch(Window window, Toolbar *data); - void saveSlitSearch(Window window, Slit *data); - void removeMenuSearch(Window window); void removeSystrayWindowSearch(Window window); void removeWindowSearch(Window window); void removeGroupSearch(Window window); - void removeToolbarSearch(Window window); - void removeSlitSearch(Window window); inline XAtom *getXAtom(void) { return xatom; } @@ -224,8 +189,6 @@ public: inline const char *getStyleFilename(void) const { return resource.style_file.c_str(); } - inline const char *getMenuFilename(void) const - { return menu_file.c_str(); } inline int getColorsPerChannel(void) const { return resource.colors_per_channel; } @@ -263,11 +226,8 @@ public: void setChangingWindow(BlackboxWindow *win); void shutdown(void); void saveStyleFilename(const std::string& filename); - void addMenuTimestamp(const std::string& filename); void restart(const char *prog = 0); void reconfigure(void); - void rereadMenu(void); - void checkMenu(void); bool validateWindow(Window window); @@ -275,9 +235,7 @@ public: virtual void timeout(void); -#ifndef HAVE_STRFTIME enum { B_AmericanDate = 1, B_EuropeanDate }; -#endif // HAVE_STRFTIME }; diff --git a/src/font.cc b/src/font.cc index ba1ae1c1..e3023187 100644 --- a/src/font.cc +++ b/src/font.cc @@ -45,7 +45,6 @@ using std::endl; string BFont::_fallback_font = "fixed"; -#ifdef XFT BFont::BFont(Display *d, BScreen *screen, const string &family, int size, bool bold, bool italic, bool shadow, unsigned char offset, unsigned char tint, bool antialias) : @@ -60,10 +59,7 @@ BFont::BFont(Display *d, BScreen *screen, const string &family, int size, _shadow(shadow), _offset(offset), _tint(tint), - _xftfont(0), - _font(0), - _fontset(0), - _fontset_extents(0) { + _xftfont(0) { _valid = False; _xftfont = XftFontOpen(_display, _screen->getScreenNumber(), @@ -80,177 +76,13 @@ BFont::BFont(Display *d, BScreen *screen, const string &family, int size, if (! _xftfont) return; // failure - _font = XLoadQueryFont(_display, buildXlfd().c_str()); - if (! _font) - return; // failure - _valid = True; } -#endif - - -BFont::BFont(Display *d, BScreen *screen, const string &xlfd) : - _display(d), - _screen(screen), -#ifdef XFT - _antialias(False), - _shadow(False), - _xftfont(0), -#endif // XFT - _font(0), - _fontset(0), - _fontset_extents(0) { - string int_xlfd; - if (xlfd.empty()) - int_xlfd = _fallback_font; - else - int_xlfd = xlfd; - - if ((_valid = createXFont(int_xlfd))) - return; // success - - if (int_xlfd != _fallback_font) { - // try the fallback - cerr << "BFont::BFont(): couldn't load font '" << _family << "'" << endl << - "Falling back to default '" << _fallback_font << "'" << endl; - - if ((_valid = createXFont(_fallback_font))) - return; // success - } - - cerr << "BFont::BFont(): couldn't load font '" << _family << "'" << endl << - "Giving up!" << endl; - return; // failure -} - - -bool BFont::createXFont(const std::string &xlfd) { - /* - Even though this is only used for font sets (multibyte), it is still parsed - out so that the bold/italic/etc information is still available from the - class when using non-multibyte. - - This is where _simplename, _bold, _italic, and _size are initialized, since - they are not initialized in the constructor. This needs to occur before - calling any Xlfd-building functions. - */ - if (! parseXlfd(xlfd)) - return False; - - if (i18n.multibyte()) { - char **missing, *def = "-"; - int nmissing; - - _fontset = XCreateFontSet(_display, buildMultibyteXlfd().c_str(), - &missing, &nmissing, &def); - if (nmissing) XFreeStringList(missing); - if (_fontset) - _fontset_extents = XExtentsOfFontSet(_fontset); - else - return False; - - assert(_fontset_extents); - } - - _font = XLoadQueryFont(_display, xlfd.c_str()); - if (! _font) - return False; - return True; -} BFont::~BFont(void) { -#ifdef XFT if (_xftfont) XftFontClose(_display, _xftfont); -#endif // XFT - - if (i18n.multibyte() && _fontset) - XFreeFontSet(_display, _fontset); - if (_font) - XFreeFont(_display, _font); -} - - -/* - * Takes _family, _size, _bold, _italic, etc and builds them into a full XLFD. - */ -string BFont::buildXlfd(void) const { - if (_simplename) - return _family; - - string weight = _bold ? "bold" : "medium"; - string slant = _italic ? "i" : "r"; - string sizestr= _size ? itostring(_size * 10) : "*"; - - return "-*-" + _family + "-" + weight + "-" + slant + "-*-*-*-" + sizestr + - "-*-*-*-*-*-*"; -} - - -/* - * Takes _family, _size, _bold, _italic, etc and builds them into a full XLFD. - */ -string BFont::buildMultibyteXlfd(void) const { - string weight = _bold ? "bold" : "medium"; - string slant = _italic ? "i" : "r"; - string sizestr= _size ? itostring(_size) : "*"; - - return _family + ',' - + "-*-*-" + weight + "-" + slant + "-*-*-*-" + sizestr + - "-*-*-*-*-*-*" + ',' - + "-*-*-*-*-*-*-*-" + sizestr + "-*-*-*-*-*-*" + ',' + - + "*"; -} - - -/* - * Takes a full X font name and parses it out so we know if we're bold, our - * size, etc. - */ -bool BFont::parseXlfd(const string &xlfd) { - if (xlfd.empty() || xlfd[0] != '-') { - _family = xlfd; - _simplename = True; - _bold = False; - _italic = False; - _size = 0; - } else { - _simplename = False; - string weight, - slant, - sizestr; - int i = 0; - - string::const_iterator it = xlfd.begin(), end = xlfd.end(); - while(1) { - string::const_iterator tmp = it; // current string.begin() - it = std::find(tmp, end, '-'); // look for comma between tmp and end - if (i == 2) _family = string(tmp, it); // s[tmp:it] - if (i == 3) weight = string(tmp, it); - if (i == 4) slant = string(tmp, it); - if (i == 7 && string(tmp, it) != "*") sizestr = string(tmp, it); - if (sizestr.empty() && - i == 8 && string(tmp, it) != "*") sizestr = string(tmp, it); - if (it == end || i >= 8) - break; - ++it; - ++i; - } - if (i < 3) // no name even! can't parse that - return False; - _bold = weight == "bold" || weight == "demibold"; - _italic = slant == "i" || slant == "o"; - _size = atoi(sizestr.c_str()) / 10; - } - - // min/max size restrictions for sanity, but 0 is the font's "default size" - if (_size && _size < 3) - _size = 3; - else if (_size > 97) - _size = 97; - - return True; } @@ -258,117 +90,60 @@ void BFont::drawString(Drawable d, int x, int y, const BColor &color, const string &string) const { assert(_valid); -#ifdef XFT - if (_xftfont) { - XftDraw *draw = XftDrawCreate(_display, d, _screen->getVisual(), - _screen->getColormap()); - assert(draw); + XftDraw *draw = XftDrawCreate(_display, d, _screen->getVisual(), + _screen->getColormap()); + assert(draw); - if (_shadow) { - XftColor c; - c.color.red = 0; - c.color.green = 0; - c.color.blue = 0; - c.color.alpha = _tint | _tint << 8; // transparent shadow - c.pixel = BlackPixel(_display, _screen->getScreenNumber()); - -#ifdef XFT_UTF8 - XftDrawStringUtf8( -#else - XftDrawString8( -#endif - draw, &c, _xftfont, x + _offset, - _xftfont->ascent + y + _offset, (XftChar8 *) string.c_str(), - string.size()); - } - + if (_shadow) { XftColor c; - c.color.red = color.red() | color.red() << 8; - c.color.green = color.green() | color.green() << 8; - c.color.blue = color.blue() | color.blue() << 8; - c.pixel = color.pixel(); - c.color.alpha = 0xff | 0xff << 8; // no transparency in BColor yet - -#ifdef XFT_UTF8 - XftDrawStringUtf8( -#else - XftDrawString8( -#endif - draw, &c, _xftfont, x, _xftfont->ascent + y, - (XftChar8 *) string.c_str(), string.size()); - - XftDrawDestroy(draw); - return; + c.color.red = 0; + c.color.green = 0; + c.color.blue = 0; + c.color.alpha = _tint | _tint << 8; // transparent shadow + c.pixel = BlackPixel(_display, _screen->getScreenNumber()); + + XftDrawStringUtf8(draw, &c, _xftfont, x + _offset, + _xftfont->ascent + y + _offset, + (XftChar8 *) string.c_str(), + string.size()); } -#endif // XFT - - BPen pen(color, _font); - - if (i18n.multibyte()) - XmbDrawString(_display, d, _fontset, pen.gc(), - x, y - _fontset_extents->max_ink_extent.y, - string.c_str(), string.size()); - else - XDrawString(_display, d, pen.gc(), - x, _font->ascent + y, - string.c_str(), string.size()); + + XftColor c; + c.color.red = color.red() | color.red() << 8; + c.color.green = color.green() | color.green() << 8; + c.color.blue = color.blue() | color.blue() << 8; + c.pixel = color.pixel(); + c.color.alpha = 0xff | 0xff << 8; // no transparency in BColor yet + + XftDrawStringUtf8(draw, &c, _xftfont, x, _xftfont->ascent + y, + (XftChar8 *) string.c_str(), string.size()); + + XftDrawDestroy(draw); + return; } unsigned int BFont::measureString(const string &string) const { assert(_valid); -#ifdef XFT - if (_xftfont) { - XGlyphInfo info; - -#ifdef XFT_UTF8 - XftTextExtentsUtf8( -#else - XftTextExtents8( -#endif - _display, _xftfont, (XftChar8 *) string.c_str(), - string.size(), &info); + XGlyphInfo info; - return info.xOff + (_shadow ? _offset : 0); - } -#endif // XFT + XftTextExtentsUtf8(_display, _xftfont, (XftChar8 *) string.c_str(), + string.size(), &info); - if (i18n.multibyte()) { - XRectangle ink, logical; - XmbTextExtents(_fontset, string.c_str(), string.size(), &ink, &logical); - return logical.width; - } else { - return XTextWidth(_font, string.c_str(), string.size()); - } + return info.xOff + (_shadow ? _offset : 0); } unsigned int BFont::height(void) const { assert(_valid); -#ifdef XFT - if (_xftfont) - return _xftfont->height + (_shadow ? _offset : 0); -#endif // XFT - - if (i18n.multibyte()) - return _fontset_extents->max_ink_extent.height; - else - return _font->ascent + _font->descent; + return _xftfont->height + (_shadow ? _offset : 0); } unsigned int BFont::maxCharWidth(void) const { assert(_valid); -#ifdef XFT - if (_xftfont) - return _xftfont->max_advance_width; -#endif // XFT - - if (i18n.multibyte()) - return _fontset_extents->max_logical_extent.width; - else - return _font->max_bounds.rbearing - _font->min_bounds.lbearing; + return _xftfont->max_advance_width; } diff --git a/src/font.hh b/src/font.hh index f28a0ac5..00c8f50e 100644 --- a/src/font.hh +++ b/src/font.hh @@ -27,9 +27,7 @@ extern "C" { #include -#ifdef XFT -# include -#endif +#include } #include @@ -69,7 +67,6 @@ private: bool _bold; bool _italic; -#ifdef XFT bool _antialias; bool _shadow; unsigned char _offset; @@ -78,31 +75,14 @@ private: XftFont *_xftfont; bool createXftFont(void); -#endif - - // standard - XFontStruct *_font; - // multibyte - XFontSet _fontset; - XFontSetExtents *_fontset_extents; - - std::string buildXlfd(void) const; - std::string buildMultibyteXlfd(void) const; - - bool createXFont(const std::string &xlfd); - bool parseXlfd(const std::string &xlfd); bool _valid; public: -#ifdef XFT // loads an Xft font BFont(Display *d, BScreen *screen, const std::string &family, int size, bool bold, bool italic, bool shadow, unsigned char offset, unsigned char tint, bool antialias = True); -#endif - // loads a standard X font - BFont(Display *d, BScreen *screen, const std::string &xlfd); virtual ~BFont(void); inline bool valid(void) const { return _valid; } diff --git a/src/image.cc b/src/image.cc index 11fcd1d7..70e1bdf3 100644 --- a/src/image.cc +++ b/src/image.cc @@ -87,8 +87,7 @@ Pixmap BImage::render_solid(const BTexture &texture) { control->getDrawable(), width, height, control->getDepth()); if (pixmap == None) { - fprintf(stderr, i18n(ImageSet, ImageErrorCreatingSolidPixmap, - "BImage::render_solid: error creating pixmap\n")); + fprintf(stderr, "BImage::render_solid: error creating pixmap\n"); return None; } @@ -454,8 +453,7 @@ XImage *BImage::renderXImage(void) { width, height, 32, 0); if (! image) { - fprintf(stderr, i18n(ImageSet, ImageErrorCreatingXImage, - "BImage::renderXImage: error creating XImage\n")); + fprintf(stderr, "BImage::renderXImage: error creating XImage\n"); return (XImage *) 0; } @@ -550,8 +548,7 @@ XImage *BImage::renderXImage(void) { } if (unsupported) { - fprintf(stderr, i18n(ImageSet, ImageUnsupVisual, - "BImage::renderXImage: unsupported visual\n")); + fprintf(stderr, "BImage::renderXImage: unsupported visual\n"); delete [] d; XDestroyImage(image); return (XImage *) 0; @@ -569,8 +566,7 @@ Pixmap BImage::renderPixmap(void) { control->getDrawable(), width, height, control->getDepth()); if (pixmap == None) { - fprintf(stderr, i18n(ImageSet, ImageErrorCreatingPixmap, - "BImage::renderPixmap: error creating pixmap\n")); + fprintf(stderr, "BImage::renderPixmap: error creating pixmap\n"); return None; } diff --git a/src/image.hh b/src/image.hh index 3482b065..a09b8fa6 100644 --- a/src/image.hh +++ b/src/image.hh @@ -138,9 +138,7 @@ private: bool dither; BaseDisplay *basedisplay; const ScreenInfo *screeninfo; -#ifdef TIMEDCACHE BTimer *timer; -#endif // TIMEDCACHE Colormap colormap; diff --git a/src/imagecontrol.cc b/src/imagecontrol.cc index 159e02fd..a7d85e2a 100644 --- a/src/imagecontrol.cc +++ b/src/imagecontrol.cc @@ -73,7 +73,6 @@ BImageControl::BImageControl(BaseDisplay *dpy, const ScreenInfo *scrn, setColorsPerChannel(_cpc); cache_max = cmax; -#ifdef TIMEDCACHE if (cache_timeout) { timer = new BTimer(basedisplay, this); timer->setTimeout(cache_timeout); @@ -81,7 +80,6 @@ BImageControl::BImageControl(BaseDisplay *dpy, const ScreenInfo *scrn, } else { timer = (BTimer *) 0; } -#endif // TIMEDCACHE colors = (XColor *) 0; ncolors = 0; @@ -151,9 +149,8 @@ BImageControl::BImageControl(BaseDisplay *dpy, const ScreenInfo *scrn, if (colors_per_channel < 2 || ncolors > (1 << screen_depth)) { fprintf(stderr, - i18n(ImageSet, ImageInvalidColormapSize, - "BImageControl::BImageControl: invalid colormap size %d " - "(%d/%d/%d) - reducing"), + "BImageControl::BImageControl: invalid colormap size %d " + "(%d/%d/%d) - reducing", ncolors, colors_per_channel, colors_per_channel, colors_per_channel); @@ -162,9 +159,8 @@ BImageControl::BImageControl(BaseDisplay *dpy, const ScreenInfo *scrn, colors = new XColor[ncolors]; if (! colors) { - fprintf(stderr, i18n(ImageSet, ImageErrorAllocatingColormap, - "BImageControl::BImageControl: error allocating " - "colormap\n")); + fprintf(stderr, "BImageControl::BImageControl: error allocating " + "colormap\n"); exit(1); } @@ -193,8 +189,7 @@ BImageControl::BImageControl(BaseDisplay *dpy, const ScreenInfo *scrn, for (i = 0; i < ncolors; i++) { if (! XAllocColor(basedisplay->getXDisplay(), colormap, &colors[i])) { - fprintf(stderr, i18n(ImageSet, ImageColorAllocFail, - "couldn't alloc color %i %i %i\n"), + fprintf(stderr, "couldn't alloc color %i %i %i\n", colors[i].red, colors[i].green, colors[i].blue); colors[i].flags = 0; } else { @@ -259,9 +254,8 @@ BImageControl::BImageControl(BaseDisplay *dpy, const ScreenInfo *scrn, if (colors_per_channel < 2 || ncolors > (1 << screen_depth)) { fprintf(stderr, - i18n(ImageSet, ImageInvalidColormapSize, - "BImageControl::BImageControl: invalid colormap size %d " - "(%d/%d/%d) - reducing"), + "BImageControl::BImageControl: invalid colormap size %d " + "(%d/%d/%d) - reducing", ncolors, colors_per_channel, colors_per_channel, colors_per_channel); @@ -271,8 +265,7 @@ BImageControl::BImageControl(BaseDisplay *dpy, const ScreenInfo *scrn, colors = new XColor[ncolors]; if (! colors) { fprintf(stderr, - i18n(ImageSet, ImageErrorAllocatingColormap, - "BImageControl::BImageControl: error allocating colormap\n")); + "BImageControl::BImageControl: error allocating colormap\n"); exit(1); } @@ -291,8 +284,7 @@ BImageControl::BImageControl(BaseDisplay *dpy, const ScreenInfo *scrn, if (! XAllocColor(basedisplay->getXDisplay(), colormap, &colors[i])) { - fprintf(stderr, i18n(ImageSet, ImageColorAllocFail, - "couldn't alloc color %i %i %i\n"), + fprintf(stderr, "couldn't alloc color %i %i %i\n", colors[i].red, colors[i].green, colors[i].blue); colors[i].flags = 0; } else { @@ -343,9 +335,7 @@ BImageControl::BImageControl(BaseDisplay *dpy, const ScreenInfo *scrn, } default: - fprintf(stderr, - i18n(ImageSet, ImageUnsupVisual, - "BImageControl::BImageControl: unsupported visual %d\n"), + fprintf(stderr, "BImageControl::BImageControl: unsupported visual %d\n", getVisual()->c_class); exit(1); } @@ -372,21 +362,18 @@ BImageControl::~BImageControl(void) { if (! cache.empty()) { //#ifdef DEBUG - fprintf(stderr, i18n(ImageSet, ImagePixmapRelease, - "BImageContol::~BImageControl: pixmap cache - " - "releasing %d pixmaps\n"), cache.size()); + fprintf(stderr, "BImageContol::~BImageControl: pixmap cache - " + "releasing %d pixmaps\n", cache.size()); //#endif CacheContainer::iterator it = cache.begin(); const CacheContainer::iterator end = cache.end(); for (; it != end; ++it) XFreePixmap(basedisplay->getXDisplay(), it->pixmap); } -#ifdef TIMEDCACHE if (timer) { timer->stop(); delete timer; } -#endif // TIMEDCACHE } @@ -449,9 +436,8 @@ Pixmap BImageControl::renderImage(unsigned int width, unsigned int height, if (cache.size() > cache_max) { #ifdef DEBUG - fprintf(stderr, i18n(ImageSet, ImagePixmapCacheLarge, - "BImageControl::renderImage: cache is large, " - "forcing cleanout\n")); + fprintf(stderr, "BImageControl::renderImage: cache is large, " + "forcing cleanout\n"); #endif // DEBUG timeout(); @@ -473,9 +459,7 @@ void BImageControl::removeImage(Pixmap pixmap) { tmp.count--; } -#ifdef TIMEDCACHE if (! timer) -#endif // TIMEDCACHE timeout(); } diff --git a/src/main.cc b/src/main.cc index f672eb23..394bfb7c 100644 --- a/src/main.cc +++ b/src/main.cc @@ -55,58 +55,52 @@ using std::string; #include "blackbox.hh" -I18n i18n; // initialized in main - static void showHelp(int exitval) { // print program usage and command line options - printf(i18n(mainSet, mainUsage, - "Openbox %s : (c) 2002 - 2002 Ben Jansens\n" - " 2001 - 2002 Sean 'Shaleh' Perry\n" - " 1997 - 2000, 2002 Brad Hughes\n\n" - " -display \t\tuse display connection.\n" - " -rc \t\t\tuse alternate resource file.\n" - " -menu \t\tuse alternate menu file.\n" - " -version\t\t\tdisplay version and exit.\n" - " -help\t\t\t\tdisplay this help text and exit.\n\n"), + printf("Openbox %s : (c) 2002 - 2002 Ben Jansens\n" + " -display \t\tuse display connection.\n" + " -rc \t\t\tuse alternate resource file.\n" + " -menu \t\tuse alternate menu file.\n" + " -version\t\t\tdisplay version and exit.\n" + " -help\t\t\t\tdisplay this help text and exit.\n\n", OPENBOX_VERSION); // some people have requested that we print out compile options // as well - printf(i18n(mainSet, mainCompileOptions, - "Compile time options:\n" - " Debugging:\t\t\t%s\n" - " Shape:\t\t\t%s\n" - " Xft:\t\t\t\t%s\n" - " Xinerama:\t\t\t%s\n" - " 8bpp Ordered Dithering:\t%s\n\n"), + printf("Compile time options:\n" + " Debugging:\t\t\t%s\n" + " Shape:\t\t\t%s\n" + " Xft:\t\t\t\t%s\n" + " Xinerama:\t\t\t%s\n" + " 8bpp Ordered Dithering:\t%s\n\n", #ifdef DEBUG - i18n(CommonSet, CommonYes, "yes"), + "yes", #else // !DEBUG - i18n(CommonSet, CommonNo, "no"), + "no", #endif // DEBUG #ifdef SHAPE - i18n(CommonSet, CommonYes, "yes"), + "yes", #else // !SHAPE - i18n(CommonSet, CommonNo, "no"), + "no", #endif // SHAPE #ifdef XFT - i18n(CommonSet, CommonYes, "yes"), + "yes", #else // !XFT - i18n(CommonSet, CommonNo, "no"), + "no", #endif // XFT #ifdef XINERAMA - i18n(CommonSet, CommonYes, "yes"), + "yes", #else // !XINERAMA - i18n(CommonSet, CommonNo, "no"), + "no", #endif // XINERAMA #ifdef ORDEREDPSEUDO - i18n(CommonSet, CommonYes, "yes") + "yes" #else // !ORDEREDPSEUDO - i18n(CommonSet, CommonNo, "no") + "no" #endif // ORDEREDPSEUDO ); @@ -118,16 +112,12 @@ int main(int argc, char **argv) { char *rc_file = (char *) 0; char *menu_file = (char *) 0; - i18n.openCatalog("openbox.cat"); - for (int i = 1; i < argc; ++i) { if (! strcmp(argv[i], "-rc")) { // look for alternative rc file to use if ((++i) >= argc) { - fprintf(stderr, - i18n(mainSet, mainRCRequiresArg, - "error: '-rc' requires and argument\n")); + fprintf(stderr, "error: '-rc' requires and argument\n"); ::exit(1); } @@ -137,9 +127,7 @@ int main(int argc, char **argv) { // look for alternative menu file to use if ((++i) >= argc) { - fprintf(stderr, - i18n(mainSet, mainMENURequiresArg, - "error: '-menu' requires and argument\n")); + fprintf(stderr, "error: '-menu' requires and argument\n"); ::exit(1); } @@ -150,9 +138,7 @@ int main(int argc, char **argv) { // set by the environment variable DISPLAY if ((++i) >= argc) { - fprintf(stderr, - i18n(mainSet, mainDISPLAYRequiresArg, - "error: '-display' requires an argument\n")); + fprintf(stderr, "error: '-display' requires an argument\n"); ::exit(1); } @@ -162,15 +148,13 @@ int main(int argc, char **argv) { dtmp += session_display; if (putenv(const_cast(dtmp.c_str()))) { - fprintf(stderr, i18n(mainSet, mainWarnDisplaySet, - "warning: couldn't set environment variable 'DISPLAY'\n")); + fprintf(stderr, + "warning: couldn't set environment variable 'DISPLAY'\n"); perror("putenv()"); } } else if (! strcmp(argv[i], "-version")) { // print current version string - printf("Openbox %s : (c) 2002 - 2002 Ben Jansens\n" - " 2001 - 2002 Sean 'Shaleh' Perry\n" - " 1997 - 2000, 2002 Brad Hughes\n\n", + printf("Openbox %s : (c) 2002 - 2002 Ben Jansens\n", OPENBOX_VERSION); ::exit(0); @@ -185,7 +169,7 @@ int main(int argc, char **argv) { _chdir2(getenv("X11ROOT")); #endif // __EMX__ - Blackbox blackbox(argv, session_display, rc_file, menu_file); + Blackbox blackbox(argv, session_display, rc_file); blackbox.eventLoop(); return(0); diff --git a/src/screen.cc b/src/screen.cc index 6fbfbdcc..37e5a194 100644 --- a/src/screen.cc +++ b/src/screen.cc @@ -75,21 +75,14 @@ extern "C" { #include using std::string; -#include "i18n.hh" #include "blackbox.hh" -#include "clientmenu.hh" #include "font.hh" #include "gccache.hh" -#include "iconmenu.hh" #include "image.hh" #include "screen.hh" -#include "slit.hh" -#include "rootmenu.hh" -#include "toolbar.hh" #include "util.hh" #include "window.hh" #include "workspace.hh" -#include "workspacemenu.hh" #include "util.hh" #include "xatom.hh" @@ -101,9 +94,9 @@ using std::string; static bool running = True; static int anotherWMRunning(Display *display, XErrorEvent *) { - fprintf(stderr, i18n(ScreenSet, ScreenAnotherWMRunning, + fprintf(stderr, "BScreen::BScreen: an error occured while querying the X server.\n" - " another window manager already running on display %s.\n"), + " another window manager already running on display %s.\n", DisplayString(display)); running = False; @@ -129,16 +122,12 @@ BScreen::BScreen(Blackbox *bb, unsigned int scrn) : ScreenInfo(bb, scrn) { managed = running; if (! managed) return; - fprintf(stderr, i18n(ScreenSet, ScreenManagingScreen, - "BScreen::BScreen: managing screen %d " - "using visual 0x%lx, depth %d\n"), + fprintf(stderr, "BScreen::BScreen: managing screen %d " + "using visual 0x%lx, depth %d\n", getScreenNumber(), XVisualIDFromVisual(getVisual()), getDepth()); - rootmenu = 0; - - resource.mstyle.t_font = resource.mstyle.f_font = resource.tstyle.font = - resource.wstyle.font = (BFont *) 0; + resource.wstyle.font = (BFont *) 0; geom_pixmap = None; @@ -178,8 +167,7 @@ BScreen::BScreen(Blackbox *bb, unsigned int scrn) : ScreenInfo(bb, scrn) { opGC = XCreateGC(blackbox->getXDisplay(), getRootWindow(), GCForeground | GCFunction | GCSubwindowMode, &gcv); - const char *s = i18n(ScreenSet, ScreenPositionLength, - "0: 0000 x 0: 0000"); + const char *s = "0: 0000 x 0: 0000"; geom_w = resource.wstyle.font->measureString(s) + resource.bevel_width * 2; geom_h = resource.wstyle.font->height() + resource.bevel_width * 2; @@ -208,46 +196,26 @@ BScreen::BScreen(Blackbox *bb, unsigned int scrn) : ScreenInfo(bb, scrn) { XSetWindowBackgroundPixmap(blackbox->getXDisplay(), geom_window, geom_pixmap); - workspacemenu = new Workspacemenu(this); - iconmenu = new Iconmenu(this); - configmenu = new Configmenu(this); - if (resource.workspaces > 0) { for (unsigned int i = 0; i < resource.workspaces; ++i) { Workspace *wkspc = new Workspace(this, workspacesList.size()); workspacesList.push_back(wkspc); - workspacemenu->insertWorkspace(wkspc); - workspacemenu->update(); } } else { Workspace *wkspc = new Workspace(this, workspacesList.size()); workspacesList.push_back(wkspc); - workspacemenu->insertWorkspace(wkspc); - workspacemenu->update(); } saveWorkspaceNames(); updateNetizenWorkspaceCount(); - workspacemenu->insert(i18n(IconSet, IconIcons, "Icons"), iconmenu); - workspacemenu->update(); - current_workspace = workspacesList.front(); xatom->setValue(getRootWindow(), XAtom::net_current_desktop, XAtom::cardinal, 0); //first workspace - workspacemenu->setItemSelected(2, True); - - toolbar = new Toolbar(this); - - slit = new Slit(this); - - InitMenu(); - raiseWindows(0, 0); // this also initializes the empty stacking list - rootmenu->update(); updateClientList(); // initialize the client lists, which will be empty updateAvailableArea(); @@ -317,27 +285,13 @@ BScreen::~BScreen(void) { std::for_each(iconList.begin(), iconList.end(), PointerAssassin()); - std::for_each(netizenList.begin(), netizenList.end(), PointerAssassin()); - while (! systrayWindowList.empty()) removeSystrayWindow(systrayWindowList[0]); - delete rootmenu; - delete workspacemenu; - delete iconmenu; - delete configmenu; - delete slit; - delete toolbar; delete image_control; if (resource.wstyle.font) delete resource.wstyle.font; - if (resource.mstyle.t_font) - delete resource.mstyle.t_font; - if (resource.mstyle.f_font) - delete resource.mstyle.f_font; - if (resource.tstyle.font) - delete resource.tstyle.font; #ifdef BITMAPBUTTONS if (resource.wstyle.close_button.mask != None) @@ -349,21 +303,9 @@ BScreen::~BScreen(void) { if (resource.wstyle.stick_button.mask != None) XFreePixmap(blackbox->getXDisplay(), resource.wstyle.stick_button.mask); - if (resource.tstyle.left_button.mask != None) - XFreePixmap(blackbox->getXDisplay(), resource.tstyle.left_button.mask); - if (resource.tstyle.right_button.mask != None) - XFreePixmap(blackbox->getXDisplay(), resource.tstyle.right_button.mask); - - if (resource.mstyle.bullet_image.mask != None) - XFreePixmap(blackbox->getXDisplay(), resource.mstyle.bullet_image.mask); - if (resource.mstyle.tick_image.mask != None) - XFreePixmap(blackbox->getXDisplay(), resource.mstyle.tick_image.mask); - resource.wstyle.max_button.mask = resource.wstyle.close_button.mask = resource.wstyle.icon_button.mask = resource.wstyle.stick_button.mask = None; - resource.tstyle.left_button.mask = resource.tstyle.right_button.mask = None; - resource.mstyle.bullet_image.mask = resource.mstyle.tick_image.mask = None; #endif // BITMAPBUTTONS XFreeGC(blackbox->getXDisplay(), opGC); @@ -441,16 +383,6 @@ void BScreen::saveShadowFonts(bool f) { } -void BScreen::saveHideToolbar(bool h) { - resource.hide_toolbar = h; - if (resource.hide_toolbar) - toolbar->unmapToolbar(); - else - toolbar->mapToolbar(); - config->setValue(screenstr + "hideToolbar", resource.hide_toolbar); -} - - void BScreen::saveWindowToEdgeSnap(int s) { resource.snap_to_edges = s; @@ -547,28 +479,11 @@ void BScreen::saveColPlacementDirection(int d) { } -#ifdef HAVE_STRFTIME void BScreen::saveStrftimeFormat(const std::string& format) { resource.strftime_format = format; config->setValue(screenstr + "strftimeFormat", resource.strftime_format); } -#else // !HAVE_STRFTIME - -void BScreen::saveDateFormat(int f) { - resource.date_format = f; - config->setValue(screenstr + "dateFormat", - resource.date_format == B_EuropeanDate ? - "European" : "American"); -} - - -void BScreen::saveClock24Hour(bool c) { - resource.clock24hour = c; - config->setValue(screenstr + "clockFormat", resource.clock24hour ? 24 : 12); -} -#endif // HAVE_STRFTIME - void BScreen::saveWorkspaceNames() { string names; @@ -623,32 +538,6 @@ void BScreen::saveRootScrollDirection(int d) { } -void BScreen::saveRootMenuButton(unsigned int b) { - resource.root_menu_button = b; - const char *but; - switch (resource.root_menu_button) { - case 0: but = "None"; break; - case 1: but = "Left"; break; - case 2: but = "Middle"; break; - case 3: default: but = "Right"; break; - } - config->setValue(screenstr + "rootMenuButton", but); -} - - -void BScreen::saveWorkspaceMenuButton(unsigned int b) { - resource.workspace_menu_button = b; - const char *but; - switch (resource.workspace_menu_button) { - case 0: but = "None"; break; - case 1: but = "Left"; break; - case 2: default: but = "Middle"; break; - case 3: but = "Right"; break; - } - config->setValue(screenstr + "workspaceMenuButton", but); -} - - void BScreen::save_rc(void) { saveSloppyFocus(resource.sloppy_focus); saveAutoRaise(resource.auto_raise); @@ -660,7 +549,6 @@ void BScreen::save_rc(void) { saveFullMax(resource.full_max); saveFocusNew(resource.focus_new); saveFocusLast(resource.focus_last); - saveHideToolbar(resource.hide_toolbar); saveWindowToWindowSnap(resource.snap_to_windows); saveWindowToEdgeSnap(resource.snap_to_edges); saveWindowCornerSnap(resource.window_corner_snap); @@ -671,22 +559,12 @@ void BScreen::save_rc(void) { saveResistanceSize(resource.resistance_size); saveRowPlacementDirection(resource.row_direction); saveColPlacementDirection(resource.col_direction); -#ifdef HAVE_STRFTIME saveStrftimeFormat(resource.strftime_format); -#else // !HAVE_STRFTIME - saveDateFormat(resource.date_format); - savwClock24Hour(resource.clock24hour); -#endif // HAVE_STRFTIME savePlaceIgnoreShaded(resource.ignore_shaded); savePlaceIgnoreMaximized(resource.ignore_maximized); saveAllowScrollLock(resource.allow_scroll_lock); saveWorkspaceWarping(resource.workspace_warping); saveRootScrollDirection(resource.root_scroll); - saveRootMenuButton(resource.root_menu_button); - saveWorkspaceMenuButton(resource.workspace_menu_button); - - toolbar->save_rc(); - slit->save_rc(); } @@ -721,9 +599,6 @@ void BScreen::load_rc(void) { resource.resize_zones != 4)) resource.resize_zones = 4; - if (! config->getValue(screenstr + "hideToolbar", resource.hide_toolbar)) - resource.hide_toolbar = false; - resource.snap_to_windows = WindowResistance; if (config->getValue(screenstr + "windowToWindowSnap", s)) { if (s == "NoSnap") @@ -820,22 +695,9 @@ void BScreen::load_rc(void) { } else resource.placement_policy = RowSmartPlacement; -#ifdef HAVE_STRFTIME if (! config->getValue(screenstr + "strftimeFormat", resource.strftime_format)) resource.strftime_format = "%I:%M %p"; -#else // !HAVE_STRFTIME - long l; - - if (config->getValue(screenstr + "dateFormat", s) && s == "European") - resource.date_format = B_EuropeanDate; - else - resource.date_format = B_AmericanDate; - - if (! config->getValue(screenstr + "clockFormat", l)) - l = 12; - resource.clock24hour = l == 24; -#endif // HAVE_STRFTIME if (! config->getValue(screenstr + "placementIgnoreShaded", resource.ignore_shaded)) @@ -860,29 +722,6 @@ void BScreen::load_rc(void) { else if (s == "Reverse") resource.root_scroll = ReverseScroll; } - - resource.root_menu_button = 3; - if (config->getValue(screenstr + "rootMenuButton", s)) { - if (s == "None") - resource.root_menu_button = 0; - else if (s == "Left") - resource.root_menu_button = 1; - else if (s == "Middle") - resource.root_menu_button = 2; - } - - resource.workspace_menu_button = 2; - if (config->getValue(screenstr + "workspaceMenuButton", s)) { - if (s == "None") - resource.workspace_menu_button = 0; - else if (s == "Left") - resource.workspace_menu_button = 1; - else if (s == "Right") - resource.workspace_menu_button = 3; - } - // cant both be the same - if (resource.workspace_menu_button == resource.root_menu_button) - resource.workspace_menu_button = 0; } @@ -909,8 +748,6 @@ void BScreen::reconfigure(void) { if (blackbox->isStartup()) return; load_rc(); - toolbar->load_rc(); - slit->load_rc(); LoadStyle(); // we need to do this explicitly, because just loading this value from the rc @@ -925,8 +762,7 @@ void BScreen::reconfigure(void) { XChangeGC(blackbox->getXDisplay(), opGC, GCForeground | GCFunction | GCSubwindowMode, &gcv); - const char *s = i18n(ScreenSet, ScreenPositionLength, - "0: 0000 x 0: 0000"); + const char *s = "0: 0000 x 0: 0000"; geom_w = resource.wstyle.font->measureString(s) + resource.bevel_width * 2; geom_h = resource.wstyle.font->height() + resource.bevel_width * 2; @@ -949,40 +785,10 @@ void BScreen::reconfigure(void) { XSetWindowBorder(blackbox->getXDisplay(), geom_window, resource.border_color.pixel()); - workspacemenu->reconfigure(); - iconmenu->reconfigure(); - typedef std::vector SubList; SubList remember_subs; - // save the current open menus - Basemenu *menu = rootmenu; - int submenu; - while ((submenu = menu->getCurrentSubmenu()) >= 0) { - remember_subs.push_back(submenu); - menu = menu->find(submenu)->submenu(); - assert(menu); - } - - InitMenu(); raiseWindows(0, 0); - rootmenu->reconfigure(); - - // reopen the saved menus - menu = rootmenu; - const SubList::iterator subs_end = remember_subs.end(); - for (SubList::iterator it = remember_subs.begin(); it != subs_end; ++it) { - menu->drawSubmenu(*it); - menu = menu->find(*it)->submenu(); - if (! menu) - break; - } - - configmenu->reconfigure(); - - toolbar->reconfigure(); - - slit->reconfigure(); std::for_each(workspacesList.begin(), workspacesList.end(), std::mem_fun(&Workspace::reconfigure)); @@ -998,14 +804,6 @@ void BScreen::reconfigure(void) { } -void BScreen::rereadMenu(void) { - InitMenu(); - raiseWindows(0, 0); - - rootmenu->reconfigure(); -} - - void BScreen::LoadStyle(void) { Configuration style(False); @@ -1027,19 +825,8 @@ void BScreen::LoadStyle(void) { // load fonts/fontsets if (resource.wstyle.font) delete resource.wstyle.font; - if (resource.tstyle.font) - delete resource.tstyle.font; - if (resource.mstyle.f_font) - delete resource.mstyle.f_font; - if (resource.mstyle.t_font) - delete resource.mstyle.t_font; - resource.wstyle.font = resource.tstyle.font = resource.mstyle.f_font = - resource.mstyle.t_font = (BFont *) 0; resource.wstyle.font = readDatabaseFont("window.", style); - resource.tstyle.font = readDatabaseFont("toolbar.", style); - resource.mstyle.t_font = readDatabaseFont("menu.title.", style); - resource.mstyle.f_font = readDatabaseFont("menu.frame.", style); // load window config resource.wstyle.t_focus = @@ -1134,126 +921,6 @@ void BScreen::LoadStyle(void) { if (resource.wstyle.h_unfocus.texture() == BTexture::Parent_Relative) resource.wstyle.h_unfocus = resource.wstyle.f_unfocus; - // load toolbar config -#ifdef BITMAPBUTTONS - if (resource.tstyle.left_button.mask != None) - XFreePixmap(blackbox->getXDisplay(), resource.tstyle.left_button.mask); - if (resource.tstyle.right_button.mask != None) - XFreePixmap(blackbox->getXDisplay(), resource.tstyle.right_button.mask); -#endif // BITMAPBUTTONS - - resource.tstyle.toolbar = - readDatabaseTexture("toolbar", "black", style); - resource.tstyle.label = - readDatabaseTexture("toolbar.label", "black", style); - resource.tstyle.window = - readDatabaseTexture("toolbar.windowLabel", "black", style); - resource.tstyle.button = - readDatabaseTexture("toolbar.button", "white", style); - resource.tstyle.pressed = - readDatabaseTexture("toolbar.button.pressed", "black", style); - resource.tstyle.clock = - readDatabaseTexture("toolbar.clock", "black", style); - resource.tstyle.l_text = - readDatabaseColor("toolbar.label.textColor", "white", style); - resource.tstyle.w_text = - readDatabaseColor("toolbar.windowLabel.textColor", "white", style); - resource.tstyle.c_text = - readDatabaseColor("toolbar.clock.textColor", "white", style); - resource.tstyle.b_pic = - readDatabaseColor("toolbar.button.picColor", "black", style); - -#ifdef BITMAPBUTTONS - readDatabaseMask("toolbar.button.left.mask", resource.tstyle.left_button, - style); - readDatabaseMask("toolbar.button.right.mask", resource.tstyle.right_button, - style); -#endif // BITMAPBUTTONS - - resource.tstyle.justify = LeftJustify; - if (style.getValue("toolbar.justify", s)) { - if (s == "right" || s == "Right") - resource.tstyle.justify = RightJustify; - else if (s == "center" || s == "Center") - resource.tstyle.justify = CenterJustify; - } - - // sanity checks - if (resource.tstyle.toolbar.texture() == BTexture::Parent_Relative) { - resource.tstyle.toolbar = BTexture("solid flat", getBaseDisplay(), - getScreenNumber(), image_control); - resource.tstyle.toolbar.setColor(BColor("black", getBaseDisplay(), - getScreenNumber())); - } - - // load menu config -#ifdef BITMAPBUTTONS - if (resource.mstyle.bullet_image.mask != None) - XFreePixmap(blackbox->getXDisplay(), resource.mstyle.bullet_image.mask); - if (resource.mstyle.tick_image.mask != None) - XFreePixmap(blackbox->getXDisplay(), resource.mstyle.tick_image.mask); -#endif // BITMAPBUTTONS - - resource.mstyle.title = - readDatabaseTexture("menu.title", "white", style); - resource.mstyle.frame = - readDatabaseTexture("menu.frame", "black", style); - resource.mstyle.hilite = - readDatabaseTexture("menu.hilite", "white", style); - resource.mstyle.t_text = - readDatabaseColor("menu.title.textColor", "black", style); - resource.mstyle.f_text = - readDatabaseColor("menu.frame.textColor", "white", style); - resource.mstyle.d_text = - readDatabaseColor("menu.frame.disableColor", "black", style); - resource.mstyle.h_text = - readDatabaseColor("menu.hilite.textColor", "black", style); - -#ifdef BITMAPBUTTONS - readDatabaseMask("menu.arrow.mask", resource.mstyle.bullet_image, style); - readDatabaseMask("menu.selected.mask", resource.mstyle.tick_image, style); -#endif // BITMAPBUTTONS - - resource.mstyle.t_justify = LeftJustify; - if (style.getValue("menu.title.justify", s)) { - if (s == "right" || s == "Right") - resource.mstyle.t_justify = RightJustify; - else if (s == "center" || s == "Center") - resource.mstyle.t_justify = CenterJustify; - } - - resource.mstyle.f_justify = LeftJustify; - if (style.getValue("menu.frame.justify", s)) { - if (s == "right" || s == "Right") - resource.mstyle.f_justify = RightJustify; - else if (s == "center" || s == "Center") - resource.mstyle.f_justify = CenterJustify; - } - - resource.mstyle.bullet = Basemenu::Triangle; - if (style.getValue("menu.bullet", s)) { - if (s == "empty" || s == "Empty") - resource.mstyle.bullet = Basemenu::Empty; - else if (s == "square" || s == "Square") - resource.mstyle.bullet = Basemenu::Square; - else if (s == "diamond" || s == "Diamond") - resource.mstyle.bullet = Basemenu::Diamond; - } - - resource.mstyle.bullet_pos = Basemenu::Left; - if (style.getValue("menu.bullet.position", s)) { - if (s == "right" || s == "Right") - resource.mstyle.bullet_pos = Basemenu::Right; - } - - // sanity checks - if (resource.mstyle.frame.texture() == BTexture::Parent_Relative) { - resource.mstyle.frame = BTexture("solid flat", getBaseDisplay(), - getScreenNumber(), image_control); - resource.mstyle.frame.setColor(BColor("black", getBaseDisplay(), - getScreenNumber())); - } - resource.border_color = readDatabaseColor("borderColor", "black", style); @@ -1285,10 +952,6 @@ void BScreen::addIcon(BlackboxWindow *w) { w->setWindowNumber(iconList.size()); iconList.push_back(w); - - const char* title = w->getIconTitle(); - iconmenu->insert(title); - iconmenu->update(); } @@ -1297,9 +960,6 @@ void BScreen::removeIcon(BlackboxWindow *w) { iconList.remove(w); - iconmenu->remove(w->getWindowNumber()); - iconmenu->update(); - BlackboxWindowList::iterator it = iconList.begin(), end = iconList.end(); for (int i = 0; it != end; ++it) @@ -1325,13 +985,6 @@ unsigned int BScreen::addWorkspace(void) { saveWorkspaces(getWorkspaceCount()); saveWorkspaceNames(); - workspacemenu->insertWorkspace(wkspc); - workspacemenu->update(); - - toolbar->reconfigure(); - - updateNetizenWorkspaceCount(); - return workspacesList.size(); } @@ -1347,17 +1000,12 @@ unsigned int BScreen::removeLastWorkspace(void) { wkspc->removeAll(); - workspacemenu->removeWorkspace(wkspc); - workspacemenu->update(); - workspacesList.pop_back(); delete wkspc; saveWorkspaces(getWorkspaceCount()); saveWorkspaceNames(); - toolbar->reconfigure(); - updateNetizenWorkspaceCount(); return workspacesList.size(); @@ -1384,16 +1032,12 @@ void BScreen::changeWorkspaceID(unsigned int id) { blackbox->setFocusedWindow((BlackboxWindow *) 0); current_workspace->hideAll(); - workspacemenu->setItemSelected(current_workspace->getID() + 2, False); current_workspace = getWorkspace(id); xatom->setValue(getRootWindow(), XAtom::net_current_desktop, XAtom::cardinal, id); - workspacemenu->setItemSelected(current_workspace->getID() + 2, True); - toolbar->redrawWorkspaceLabel(True); - current_workspace->showAll(); int x, y, rx, ry; @@ -1432,8 +1076,6 @@ void BScreen::changeWorkspaceID(unsigned int id) { blackbox->setFocusedWindow(win); else blackbox->setFocusedWindow((BlackboxWindow *) 0); - - updateNetizenCurrentWorkspace(); } @@ -1543,7 +1185,7 @@ void BScreen::manageWindow(Window w) { XWMHints *wmhint = XGetWMHints(blackbox->getXDisplay(), w); if (wmhint && (wmhint->flags & StateHint) && wmhint->initial_state == WithdrawnState) { - slit->addClient(w); + //slit->addClient(w); return; } @@ -1626,8 +1268,6 @@ void BScreen::unmanageWindow(BlackboxWindow *w, bool remap) { if (blackbox->getFocusedWindow() == w) blackbox->setFocusedWindow((BlackboxWindow *) 0); - removeNetizen(w->getClientWindow()); - /* some managed windows can also be window group controllers. when unmanaging such windows, we should also delete the window group. @@ -1639,35 +1279,6 @@ void BScreen::unmanageWindow(BlackboxWindow *w, bool remap) { } -void BScreen::addNetizen(Netizen *n) { - netizenList.push_back(n); - - n->sendWorkspaceCount(); - n->sendCurrentWorkspace(); - - WorkspaceList::iterator it = workspacesList.begin(); - const WorkspaceList::iterator end = workspacesList.end(); - for (; it != end; ++it) - (*it)->sendWindowList(*n); - - Window f = ((blackbox->getFocusedWindow()) ? - blackbox->getFocusedWindow()->getClientWindow() : None); - n->sendWindowFocus(f); -} - - -void BScreen::removeNetizen(Window w) { - NetizenList::iterator it = netizenList.begin(); - for (; it != netizenList.end(); ++it) { - if ((*it)->getWindowID() == w) { - delete *it; - netizenList.erase(it); - break; - } - } -} - - void BScreen::updateWorkArea(void) { if (workspacesList.size() > 0) { unsigned long *dims = new unsigned long[4 * workspacesList.size()]; @@ -1688,20 +1299,11 @@ void BScreen::updateWorkArea(void) { } -void BScreen::updateNetizenCurrentWorkspace(void) { - std::for_each(netizenList.begin(), netizenList.end(), - std::mem_fun(&Netizen::sendCurrentWorkspace)); -} - - void BScreen::updateNetizenWorkspaceCount(void) { xatom->setValue(getRootWindow(), XAtom::net_number_of_desktops, XAtom::cardinal, workspacesList.size()); updateWorkArea(); - - std::for_each(netizenList.begin(), netizenList.end(), - std::mem_fun(&Netizen::sendWorkspaceCount)); } @@ -1711,46 +1313,6 @@ void BScreen::updateNetizenWindowFocus(void) { xatom->setValue(getRootWindow(), XAtom::net_active_window, XAtom::window, f); - - NetizenList::iterator it = netizenList.begin(); - for (; it != netizenList.end(); ++it) - (*it)->sendWindowFocus(f); -} - - -void BScreen::updateNetizenWindowAdd(Window w, unsigned long p) { - NetizenList::iterator it = netizenList.begin(); - for (; it != netizenList.end(); ++it) { - (*it)->sendWindowAdd(w, p); - } -} - - -void BScreen::updateNetizenWindowDel(Window w) { - NetizenList::iterator it = netizenList.begin(); - for (; it != netizenList.end(); ++it) - (*it)->sendWindowDel(w); -} - - -void BScreen::updateNetizenWindowRaise(Window w) { - NetizenList::iterator it = netizenList.begin(); - for (; it != netizenList.end(); ++it) - (*it)->sendWindowRaise(w); -} - - -void BScreen::updateNetizenWindowLower(Window w) { - NetizenList::iterator it = netizenList.begin(); - for (; it != netizenList.end(); ++it) - (*it)->sendWindowLower(w); -} - - -void BScreen::updateNetizenConfigNotify(XEvent *e) { - NetizenList::iterator it = netizenList.begin(); - for (; it != netizenList.end(); ++it) - (*it)->sendConfigNotify(e); } @@ -1760,56 +1322,11 @@ void BScreen::raiseWindows(Window *workspace_stack, unsigned int num) { #ifdef XINERAMA ++bbwins; #endif // XINERAMA -#ifdef XFT - ++bbwins; -#endif // XFT Window *session_stack = new - Window[(num + workspacesList.size() + rootmenuList.size() + - specialWindowList.size() + bbwins)]; + Window[(num + specialWindowList.size() + bbwins)]; unsigned int i = 0, k = num; - XRaiseWindow(blackbox->getXDisplay(), iconmenu->getWindowID()); - *(session_stack + i++) = iconmenu->getWindowID(); - - WorkspaceList::iterator wit = workspacesList.begin(); - const WorkspaceList::iterator w_end = workspacesList.end(); - for (; wit != w_end; ++wit) - *(session_stack + i++) = (*wit)->getMenu()->getWindowID(); - - *(session_stack + i++) = workspacemenu->getWindowID(); - - *(session_stack + i++) = configmenu->getFocusmenu()->getWindowID(); - *(session_stack + i++) = configmenu->getPlacementmenu()->getWindowID(); - *(session_stack + i++) = configmenu->getWindowSnapmenu()->getWindowID(); - *(session_stack + i++) = configmenu->getEdgeSnapmenu()->getWindowID(); -#ifdef XINERAMA - *(session_stack + i++) = configmenu->getXineramamenu()->getWindowID(); -#endif // XINERAMA -#ifdef XFT - *(session_stack + i++) = configmenu->getXftmenu()->getWindowID(); -#endif // XFT - *(session_stack + i++) = configmenu->getWindowID(); - - *(session_stack + i++) = slit->getMenu()->getDirectionmenu()->getWindowID(); - *(session_stack + i++) = slit->getMenu()->getPlacementmenu()->getWindowID(); - *(session_stack + i++) = slit->getMenu()->getWindowID(); - - *(session_stack + i++) = - toolbar->getMenu()->getPlacementmenu()->getWindowID(); - *(session_stack + i++) = toolbar->getMenu()->getWindowID(); - - RootmenuList::iterator rit = rootmenuList.begin(); - for (; rit != rootmenuList.end(); ++rit) - *(session_stack + i++) = (*rit)->getWindowID(); - *(session_stack + i++) = rootmenu->getWindowID(); - - if (toolbar->isOnTop()) - *(session_stack + i++) = toolbar->getWindowID(); - - if (slit->isOnTop()) - *(session_stack + i++) = slit->getWindowID(); - WindowList::iterator sit, send = specialWindowList.end(); for (sit = specialWindowList.begin(); sit != send; ++sit) *(session_stack + i++) = *sit; @@ -1878,15 +1395,7 @@ void BScreen::reassociateWindow(BlackboxWindow *w, unsigned int wkspc_id, void BScreen::propagateWindowName(const BlackboxWindow *bw) { if (bw->isIconic()) { - iconmenu->changeItemLabel(bw->getWindowNumber(), bw->getIconTitle()); - iconmenu->update(); } else { - Clientmenu *clientmenu = getWorkspace(bw->getWorkspaceNumber())->getMenu(); - clientmenu->changeItemLabel(bw->getWindowNumber(), bw->getTitle()); - clientmenu->update(); - - if (blackbox->getFocusedWindow() == bw) - toolbar->redrawWindowLabel(True); } } @@ -1953,409 +1462,6 @@ void BScreen::raiseFocus(void) const { } -void BScreen::InitMenu(void) { - if (rootmenu) { - rootmenuList.clear(); - - while (rootmenu->getCount()) - rootmenu->remove(0); - } else { - rootmenu = new Rootmenu(this); - } - bool defaultMenu = True; - - FILE *menu_file = (FILE *) 0; - const char *menu_filename = blackbox->getMenuFilename(); - - if (menu_filename) - if (! (menu_file = fopen(menu_filename, "r"))) - perror(menu_filename); - if (! menu_file) { // opening the menu file failed, try the default menu - menu_filename = DEFAULTMENU; - if (! (menu_file = fopen(menu_filename, "r"))) - perror(menu_filename); - } - - if (menu_file) { - if (feof(menu_file)) { - fprintf(stderr, i18n(ScreenSet, ScreenEmptyMenuFile, - "%s: Empty menu file"), - menu_filename); - } else { - char line[1024], label[1024]; - memset(line, 0, 1024); - memset(label, 0, 1024); - - while (fgets(line, 1024, menu_file) && ! feof(menu_file)) { - if (line[0] == '#') - continue; - - int i, key = 0, index = -1, len = strlen(line); - - for (i = 0; i < len; i++) { - if (line[i] == '[') index = 0; - else if (line[i] == ']') break; - else if (line[i] != ' ') - if (index++ >= 0) - key += tolower(line[i]); - } - - if (key == 517) { // [begin] - index = -1; - for (i = index; i < len; i++) { - if (line[i] == '(') index = 0; - else if (line[i] == ')') break; - else if (index++ >= 0) { - if (line[i] == '\\' && i < len - 1) i++; - label[index - 1] = line[i]; - } - } - - if (index == -1) index = 0; - label[index] = '\0'; - - rootmenu->setLabel(label); - defaultMenu = parseMenuFile(menu_file, rootmenu); - if (! defaultMenu) - blackbox->addMenuTimestamp(menu_filename); - break; - } - } - } - fclose(menu_file); - } - - if (defaultMenu) { - rootmenu->setInternalMenu(); - rootmenu->insert(i18n(ScreenSet, Screenxterm, "xterm"), - BScreen::Execute, - i18n(ScreenSet, Screenxterm, "xterm")); - rootmenu->insert(i18n(ScreenSet, ScreenRestart, "Restart"), - BScreen::Restart); - rootmenu->insert(i18n(ScreenSet, ScreenExit, "Exit"), - BScreen::Exit); - rootmenu->setLabel(i18n(BasemenuSet, BasemenuBlackboxMenu, - "Openbox Menu")); - } -} - - -static -size_t string_within(char begin, char end, - const char *input, size_t start_at, size_t length, - char *output) { - bool parse = False; - size_t index = 0; - size_t i = start_at; - for (; i < length; ++i) { - if (input[i] == begin) { - parse = True; - } else if (input[i] == end) { - break; - } else if (parse) { - if (input[i] == '\\' && i < length - 1) i++; - output[index++] = input[i]; - } - } - - if (parse) - output[index] = '\0'; - else - output[0] = '\0'; - - return i; -} - - -bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) { - char line[1024], keyword[1024], label[1024], command[1024]; - bool done = False; - - while (! (done || feof(file))) { - memset(line, 0, 1024); - memset(label, 0, 1024); - memset(command, 0, 1024); - - if (! fgets(line, 1024, file)) - continue; - - if (line[0] == '#') // comment, skip it - continue; - - size_t line_length = strlen(line); - unsigned int key = 0; - - // get the keyword enclosed in []'s - size_t pos = string_within('[', ']', line, 0, line_length, keyword); - - if (keyword[0] == '\0') { // no keyword, no menu entry - continue; - } else { - size_t len = strlen(keyword); - for (size_t i = 0; i < len; ++i) { - if (keyword[i] != ' ') - key += tolower(keyword[i]); - } - } - - // get the label enclosed in ()'s - pos = string_within('(', ')', line, pos, line_length, label); - - // get the command enclosed in {}'s - pos = string_within('{', '}', line, pos, line_length, command); - - switch (key) { - case 311: // end - done = True; - - break; - - case 333: // nop - if (! *label) - label[0] = '\0'; - menu->insert(label); - - break; - - case 421: // exec - if (! (*label && *command)) { - fprintf(stderr, i18n(ScreenSet, ScreenEXECError, - "BScreen::parseMenuFile: [exec] error, " - "no menu label and/or command defined\n")); - continue; - } - - menu->insert(label, BScreen::Execute, command); - - break; - - case 442: // exit - if (! *label) { - fprintf(stderr, i18n(ScreenSet, ScreenEXITError, - "BScreen::parseMenuFile: [exit] error, " - "no menu label defined\n")); - continue; - } - - menu->insert(label, BScreen::Exit); - - break; - - case 561: { // style - if (! (*label && *command)) { - fprintf(stderr, - i18n(ScreenSet, ScreenSTYLEError, - "BScreen::parseMenuFile: [style] error, " - "no menu label and/or filename defined\n")); - continue; - } - - string style = expandTilde(command); - - menu->insert(label, BScreen::SetStyle, style.c_str()); - } - break; - - case 630: // config - if (! *label) { - fprintf(stderr, i18n(ScreenSet, ScreenCONFIGError, - "BScreen::parseMenufile: [config] error, " - "no label defined")); - continue; - } - - menu->insert(label, configmenu); - - break; - - case 740: { // include - if (! *label) { - fprintf(stderr, i18n(ScreenSet, ScreenINCLUDEError, - "BScreen::parseMenuFile: [include] error, " - "no filename defined\n")); - continue; - } - - string newfile = expandTilde(label); - FILE *submenufile = fopen(newfile.c_str(), "r"); - - if (! submenufile) { - perror(newfile.c_str()); - continue; - } - - struct stat buf; - if (fstat(fileno(submenufile), &buf) || - ! S_ISREG(buf.st_mode)) { - fprintf(stderr, - i18n(ScreenSet, ScreenINCLUDEErrorReg, - "BScreen::parseMenuFile: [include] error: " - "'%s' is not a regular file\n"), newfile.c_str()); - break; - } - - if (! feof(submenufile)) { - if (! parseMenuFile(submenufile, menu)) - blackbox->addMenuTimestamp(newfile); - - fclose(submenufile); - } - } - - break; - - case 767: { // submenu - if (! *label) { - fprintf(stderr, i18n(ScreenSet, ScreenSUBMENUError, - "BScreen::parseMenuFile: [submenu] error, " - "no menu label defined\n")); - continue; - } - - Rootmenu *submenu = new Rootmenu(this); - - if (*command) - submenu->setLabel(command); - else - submenu->setLabel(label); - - parseMenuFile(file, submenu); - submenu->update(); - menu->insert(label, submenu); - rootmenuList.push_back(submenu); - } - - break; - - case 773: { // restart - if (! *label) { - fprintf(stderr, i18n(ScreenSet, ScreenRESTARTError, - "BScreen::parseMenuFile: [restart] error, " - "no menu label defined\n")); - continue; - } - - if (*command) - menu->insert(label, BScreen::RestartOther, command); - else - menu->insert(label, BScreen::Restart); - } - - break; - - case 845: { // reconfig - if (! *label) { - fprintf(stderr, - i18n(ScreenSet, ScreenRECONFIGError, - "BScreen::parseMenuFile: [reconfig] error, " - "no menu label defined\n")); - continue; - } - - menu->insert(label, BScreen::Reconfigure); - } - - break; - - case 995: // stylesdir - case 1113: { // stylesmenu - bool newmenu = ((key == 1113) ? True : False); - - if (! *label || (! *command && newmenu)) { - fprintf(stderr, - i18n(ScreenSet, ScreenSTYLESDIRError, - "BScreen::parseMenuFile: [stylesdir/stylesmenu]" - " error, no directory defined\n")); - continue; - } - - char *directory = ((newmenu) ? command : label); - - string stylesdir = expandTilde(directory); - - struct stat statbuf; - - if (stat(stylesdir.c_str(), &statbuf) == -1) { - fprintf(stderr, - i18n(ScreenSet, ScreenSTYLESDIRErrorNoExist, - "BScreen::parseMenuFile: [stylesdir/stylesmenu]" - " error, %s does not exist\n"), stylesdir.c_str()); - continue; - } - if (! S_ISDIR(statbuf.st_mode)) { - fprintf(stderr, - i18n(ScreenSet, ScreenSTYLESDIRErrorNotDir, - "BScreen::parseMenuFile:" - " [stylesdir/stylesmenu] error, %s is not a" - " directory\n"), stylesdir.c_str()); - continue; - } - - Rootmenu *stylesmenu; - - if (newmenu) - stylesmenu = new Rootmenu(this); - else - stylesmenu = menu; - - DIR *d = opendir(stylesdir.c_str()); - struct dirent *p; - std::vector ls; - - while((p = readdir(d))) - ls.push_back(p->d_name); - - closedir(d); - - std::sort(ls.begin(), ls.end()); - - std::vector::iterator it = ls.begin(), - end = ls.end(); - for (; it != end; ++it) { - const string& fname = *it; - - if (fname[fname.size()-1] == '~') - continue; - - string style = stylesdir; - style += '/'; - style += fname; - - if (! stat(style.c_str(), &statbuf) && S_ISREG(statbuf.st_mode)) - stylesmenu->insert(fname, BScreen::SetStyle, style); - } - - stylesmenu->update(); - - if (newmenu) { - stylesmenu->setLabel(label); - menu->insert(label, stylesmenu); - rootmenuList.push_back(stylesmenu); - } - - blackbox->addMenuTimestamp(stylesdir); - } - break; - - case 1090: { // workspaces - if (! *label) { - fprintf(stderr, - i18n(ScreenSet, ScreenWORKSPACESError, - "BScreen:parseMenuFile: [workspaces] error, " - "no menu label defined\n")); - continue; - } - - menu->insert(label, workspacemenu); - } - break; - } - } - - return ((menu->getCount() == 0) ? True : False); -} - - void BScreen::shutdown(void) { XSelectInput(blackbox->getXDisplay(), getRootWindow(), NoEventMask); XSync(blackbox->getXDisplay(), False); @@ -2368,8 +1474,6 @@ void BScreen::shutdown(void) { assert(win); unmanageWindow(win, True); } - - slit->shutdown(); } @@ -2386,8 +1490,7 @@ void BScreen::showPosition(int x, int y) { char label[1024]; - sprintf(label, i18n(ScreenSet, ScreenPositionFormat, - "X: %4d x Y: %4d"), x, y); + sprintf(label, "X: %4d x Y: %4d", x, y); XClearWindow(blackbox->getXDisplay(), geom_window); @@ -2411,8 +1514,7 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) { char label[1024]; - sprintf(label, i18n(ScreenSet, ScreenGeometryFormat, - "W: %4d x H: %4d"), gx, gy); + sprintf(label, "W: %4d x H: %4d", gx, gy); XClearWindow(blackbox->getXDisplay(), geom_window); @@ -2539,11 +1641,6 @@ void BScreen::buttonPressEvent(const XButtonEvent *xbutton) { if (! isRootColormapInstalled()) image_control->installRootColormap(); - if (workspacemenu->isVisible()) - workspacemenu->hide(); - - if (rootmenu->isVisible()) - rootmenu->hide(); // mouse wheel up } else if ((xbutton->button == 4 && resource.root_scroll == NormalScroll) || (xbutton->button == 5 && resource.root_scroll == ReverseScroll)) { @@ -2559,57 +1656,6 @@ void BScreen::buttonPressEvent(const XButtonEvent *xbutton) { else changeWorkspaceID(getCurrentWorkspaceID() - 1); } - - if (resource.root_menu_button > 0 && - xbutton->button == resource.root_menu_button) - showRootMenu(xbutton->x_root, xbutton->y_root); - else if (resource.workspace_menu_button > 0 && - xbutton->button == resource.workspace_menu_button) - showWorkspaceMenu(xbutton->x_root, xbutton->y_root); -} - - -void BScreen::showWorkspaceMenu(int x, int y) { - int mx = x - (workspacemenu->getWidth() / 2); - int my = y - (workspacemenu->getTitleHeight() / 2); - - if (mx < 0) mx = 0; - if (my < 0) my = 0; - - if (mx + workspacemenu->getWidth() > getWidth()) - mx = getWidth() - workspacemenu->getWidth() - getBorderWidth(); - - if (my + workspacemenu->getHeight() > getHeight()) - my = getHeight() - workspacemenu->getHeight() - getBorderWidth(); - - workspacemenu->move(mx, my); - - if (! workspacemenu->isVisible()) { - workspacemenu->removeParent(); - workspacemenu->show(); - } -} - - -void BScreen::showRootMenu(int x, int y) { - int mx = x - (rootmenu->getWidth() / 2); - int my = y - (rootmenu->getTitleHeight() / 2); - - if (mx < 0) mx = 0; - if (my < 0) my = 0; - - if (mx + rootmenu->getWidth() > getWidth()) - mx = getWidth() - rootmenu->getWidth() - getBorderWidth(); - - if (my + rootmenu->getHeight() > getHeight()) - my = getHeight() - rootmenu->getHeight() - getBorderWidth(); - - rootmenu->move(mx, my); - - if (! rootmenu->isVisible()) { - blackbox->checkMenu(); - rootmenu->show(); - } } @@ -2620,10 +1666,9 @@ void BScreen::propertyNotifyEvent(const XPropertyEvent *pe) { const WorkspaceList::iterator end = workspacesList.end(); for (; it != end; ++it) { (*it)->readName(); // re-read its name from the window property - workspacemenu->changeWorkspaceLabel((*it)->getID(), (*it)->getName()); + //workspacemenu->changeWorkspaceLabel((*it)->getID(), (*it)->getName()); } - workspacemenu->update(); - toolbar->reconfigure(); + //workspacemenu->update(); saveWorkspaceNames(); } } @@ -2725,7 +1770,6 @@ BFont *BScreen::readDatabaseFont(const string &rbasename, string s; -#ifdef XFT int i; if (style.getValue(rbasename + "xft.font", s) && style.getValue(rbasename + "xft.size", i)) { @@ -2761,17 +1805,8 @@ BFont *BScreen::readDatabaseFont(const string &rbasename, tint, resource.aa_fonts); if (b->valid()) return b; - else - delete b; // fall back to the normal X font stuff + delete b; } -#endif // XFT - - style.getValue(rbasename + "font", s); - // if this fails, a blank string will be used, which will cause the fallback - // font to load. - - BFont *b = new BFont(blackbox->getXDisplay(), this, s); - if (! b->valid()) - exit(2); // can't continue without a font - return b; + + exit(2); // can't continue without a font } diff --git a/src/screen.hh b/src/screen.hh index 53fdffdd..57a03b0b 100644 --- a/src/screen.hh +++ b/src/screen.hh @@ -45,13 +45,8 @@ extern "C" { #include "color.hh" #include "texture.hh" #include "image.hh" -#include "configmenu.hh" -#include "iconmenu.hh" -#include "netizen.hh" -#include "rootmenu.hh" #include "timer.hh" #include "workspace.hh" -#include "workspacemenu.hh" #include "blackbox.hh" class Slit; // forward reference @@ -86,36 +81,6 @@ struct WindowStyle { unsigned int max_length, unsigned int modifier) const; }; -struct ToolbarStyle { - BColor l_text, w_text, c_text, b_pic; - BTexture toolbar, label, window, button, pressed, clock; - -#ifdef BITMAPBUTTONS - PixmapMask left_button, right_button; -#endif // BITMAPBUTTONS - - BFont *font; - - TextJustify justify; - - void doJustify(const std::string &text, int &start_pos, - unsigned int max_length, unsigned int modifier) const; -}; - -struct MenuStyle { - BColor t_text, f_text, h_text, d_text; - BTexture title, frame, hilite; - -#ifdef BITMAPBUTTONS - PixmapMask bullet_image, tick_image; -#endif // BITMAPBUTTONS - - BFont *t_font, *f_font; - - TextJustify t_justify, f_justify; - int bullet, bullet_pos; -}; - class BScreen : public ScreenInfo { private: bool root_colormap_installed, managed, geom_visible; @@ -125,26 +90,15 @@ private: Blackbox *blackbox; BImageControl *image_control; - Configmenu *configmenu; - Iconmenu *iconmenu; - Rootmenu *rootmenu; Configuration *config; XAtom *xatom; - typedef std::list RootmenuList; - RootmenuList rootmenuList; - - typedef std::list NetizenList; - NetizenList netizenList; BlackboxWindowList iconList, windowList; typedef std::vector WindowList; WindowList specialWindowList, desktopWindowList, systrayWindowList; - Slit *slit; - Toolbar *toolbar; Workspace *current_workspace; - Workspacemenu *workspacemenu; unsigned int geom_w, geom_h; unsigned long event_mask; @@ -161,12 +115,10 @@ private: struct screen_resource { WindowStyle wstyle; - ToolbarStyle tstyle; - MenuStyle mstyle; bool sloppy_focus, auto_raise, auto_edge_balance, ordered_dither, opaque_move, full_max, focus_new, focus_last, click_raise, - allow_scroll_lock, hide_toolbar, window_corner_snap, aa_fonts, + allow_scroll_lock, window_corner_snap, aa_fonts, ignore_shaded, ignore_maximized, workspace_warping, shadow_fonts; int snap_to_windows, snap_to_edges; @@ -175,21 +127,14 @@ private: BColor border_color; unsigned int workspaces; - int toolbar_placement, toolbar_width_percent, placement_policy, + int placement_policy, snap_threshold, row_direction, col_direction, root_scroll, resistance_size; unsigned int handle_width, bevel_width, frame_width, border_width, resize_zones; - unsigned int root_menu_button, workspace_menu_button; - -#ifdef HAVE_STRFTIME std::string strftime_format; -#else // !HAVE_STRFTIME - bool clock24hour; - int date_format; -#endif // HAVE_STRFTIME } resource; std::string screenstr; @@ -197,8 +142,6 @@ private: BScreen(const BScreen&); BScreen& operator=(const BScreen&); - bool parseMenuFile(FILE *file, Rootmenu *menu); - #ifdef BITMAPBUTTONS void readDatabaseMask(const std::string &rname, PixmapMask &pixmapMask, @@ -215,11 +158,16 @@ private: BFont *readDatabaseFont(const std::string &rbasename, const Configuration &style); - void InitMenu(void); void LoadStyle(void); void updateWorkArea(void); + public: + // XXX: temporary + void updateNetizenWorkspaceCount(); + void updateNetizenWindowFocus(); + + enum { WindowNoSnap = 0, WindowSnap, WindowResistance }; enum { RowSmartPlacement = 1, ColSmartPlacement, CascadePlacement, UnderMousePlacement, ClickMousePlacement, LeftRight, RightLeft, @@ -248,7 +196,6 @@ public: inline bool doFullMax(void) const { return resource.full_max; } inline bool doFocusNew(void) const { return resource.focus_new; } inline bool doFocusLast(void) const { return resource.focus_last; } - inline bool doHideToolbar(void) const { return resource.hide_toolbar; } inline int getWindowToWindowSnap(void) const { return resource.snap_to_windows; } inline int getWindowToEdgeSnap(void) const @@ -259,27 +206,17 @@ public: inline bool doWorkspaceWarping(void) const { return resource.workspace_warping; } inline int rootScrollDirection(void) const { return resource.root_scroll; } - inline unsigned int rootMenuButton(void) const - { return resource.root_menu_button; } - inline unsigned int workspaceMenuButton(void) const - { return resource.workspace_menu_button; } inline const GC &getOpGC(void) const { return opGC; } inline Blackbox *getBlackbox(void) { return blackbox; } inline BColor *getBorderColor(void) { return &resource.border_color; } inline BImageControl *getImageControl(void) { return image_control; } - inline Rootmenu *getRootmenu(void) { return rootmenu; } - - inline Slit *getSlit(void) { return slit; } - inline Toolbar *getToolbar(void) { return toolbar; } Workspace *getWorkspace(unsigned int index) const; inline Workspace *getCurrentWorkspace(void) { return current_workspace; } - inline Workspacemenu *getWorkspacemenu(void) { return workspacemenu; } - inline unsigned int getHandleWidth(void) const { return resource.handle_width; } inline unsigned int getBevelWidth(void) const @@ -335,7 +272,6 @@ public: void saveFullMax(bool f); void saveFocusNew(bool f); void saveFocusLast(bool f); - void saveHideToolbar(bool h); void saveWindowToEdgeSnap(int s); void saveWindowToWindowSnap(int s); void saveWindowCornerSnap(bool s); @@ -345,24 +281,12 @@ public: void saveAllowScrollLock(bool a); void saveWorkspaceWarping(bool w); void saveRootScrollDirection(int d); - void saveRootMenuButton(unsigned int b); - void saveWorkspaceMenuButton(unsigned int b); - inline void iconUpdate(void) { iconmenu->update(); } -#ifdef HAVE_STRFTIME inline const char *getStrftimeFormat(void) { return resource.strftime_format.c_str(); } void saveStrftimeFormat(const std::string& format); -#else // !HAVE_STRFTIME - inline int getDateFormat(void) { return resource.date_format; } - inline void saveDateFormat(int f); - inline bool isClock24Hour(void) { return resource.clock24hour; } - inline void saveClock24Hour(bool c); -#endif // HAVE_STRFTIME inline WindowStyle *getWindowStyle(void) { return &resource.wstyle; } - inline MenuStyle *getMenuStyle(void) { return &resource.mstyle; } - inline ToolbarStyle *getToolbarStyle(void) { return &resource.tstyle; } BlackboxWindow *getIcon(unsigned int index); @@ -381,9 +305,6 @@ public: void changeWorkspaceID(unsigned int id); void saveWorkspaceNames(void); - void addNetizen(Netizen *n); - void removeNetizen(Window w); - void addSystrayWindow(Window window); void removeSystrayWindow(Window window); @@ -406,26 +327,13 @@ public: void save_rc(void); void reconfigure(void); void toggleFocusModel(FocusModel model); - void rereadMenu(void); void shutdown(void); void showPosition(int x, int y); void showGeometry(unsigned int gx, unsigned int gy); void hideGeometry(void); - void showWorkspaceMenu(int x, int y); - void showRootMenu(int x, int y); - void buttonPressEvent(const XButtonEvent *xbutton); void propertyNotifyEvent(const XPropertyEvent *pe); - - void updateNetizenCurrentWorkspace(void); - void updateNetizenWorkspaceCount(void); - void updateNetizenWindowFocus(void); - void updateNetizenWindowAdd(Window w, unsigned long p); - void updateNetizenWindowDel(Window w); - void updateNetizenConfigNotify(XEvent *e); - void updateNetizenWindowRaise(Window w); - void updateNetizenWindowLower(Window w); }; diff --git a/src/window.cc b/src/window.cc index 206e66c6..a0711e05 100644 --- a/src/window.cc +++ b/src/window.cc @@ -45,18 +45,13 @@ extern "C" { } #include "blackbox.hh" -#include "clientmenu.hh" #include "font.hh" #include "gccache.hh" -#include "iconmenu.hh" #include "image.hh" #include "screen.hh" -#include "toolbar.hh" #include "util.hh" #include "window.hh" -#include "windowmenu.hh" #include "workspace.hh" -#include "slit.hh" using std::string; using std::abs; @@ -149,8 +144,6 @@ BlackboxWindow::BlackboxWindow(Blackbox *b, Window w, BScreen *s) { current_state = NormalState; - windowmenu = 0; - /* set the initial size and location of client window (relative to the _root window_). This position is the reference point used with the @@ -331,9 +324,6 @@ BlackboxWindow::BlackboxWindow(Blackbox *b, Window w, BScreen *s) { if (flags.maximized && (functions & Func_Maximize)) 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 windowmenu; - if (client.window_group) { BWindowGroup *group = blackbox->searchGroup(client.window_group); if (group) group->removeWindow(this); @@ -974,11 +962,6 @@ void BlackboxWindow::reconfigure(void) { ungrabButtons(); grabButtons(); - - if (windowmenu) { - windowmenu->move(windowmenu->getX(), frame.rect.y() + frame.title_h); - windowmenu->reconfigure(); - } } @@ -1161,7 +1144,7 @@ void BlackboxWindow::getWMName(void) { return; } // fall back to an internal default - client.title = i18n(WindowSet, WindowUnnamed, "Unnamed"); + client.title = "Unnamed"; xatom->setValue(client.window, XAtom::net_wm_visible_name, XAtom::utf8, client.title); @@ -1215,8 +1198,6 @@ void BlackboxWindow::getWMProtocols(void) { functions |= Func_Close; } else if (proto[i] == xatom->getAtom(XAtom::wm_take_focus)) flags.send_focus_message = True; - else if (proto[i] == xatom->getAtom(XAtom::blackbox_structure_messages)) - screen->addNetizen(new Netizen(screen, client.window)); } XFree(proto); @@ -1669,7 +1650,6 @@ void BlackboxWindow::configure(int dx, int dy, XSendEvent(blackbox->getXDisplay(), client.window, False, StructureNotifyMask, &event); - screen->updateNetizenConfigNotify(&event); XFlush(blackbox->getXDisplay()); } } @@ -1783,8 +1763,6 @@ void BlackboxWindow::iconify(void) { if (flags.moving) endMove(); - if (windowmenu) windowmenu->hide(); - /* * we don't want this XUnmapWindow call to generate an UnmapNotify event, so * we need to clear the event mask on client.window for a split second. @@ -1921,8 +1899,6 @@ void BlackboxWindow::withdraw(void) { XSelectInput(blackbox->getXDisplay(), client.window, event_mask); XUngrabServer(blackbox->getXDisplay()); - - if (windowmenu) windowmenu->hide(); } @@ -1934,9 +1910,6 @@ void BlackboxWindow::maximize(unsigned int button) { if (flags.moving) endMove(); - // handle case where menu is open then the max button is used instead - if (windowmenu && windowmenu->isVisible()) windowmenu->hide(); - if (flags.maximized) { flags.maximized = 0; @@ -2257,15 +2230,6 @@ void BlackboxWindow::setFocusFlag(bool focus) { if (flags.focused) blackbox->setFocusedWindow(this); - - if (! flags.iconic) { - // iconic windows arent in a workspace menu! - if (flags.stuck) - screen->getCurrentWorkspace()->setFocused(this, isFocused()); - else - screen->getWorkspace(blackbox_attrib.workspace)-> - setFocused(this, flags.focused); - } } @@ -2994,7 +2958,6 @@ void BlackboxWindow::propertyNotifyEvent(const XPropertyEvent *pe) { positionButtons(True); XMapSubwindows(blackbox->getXDisplay(), frame.title); } - if (windowmenu) windowmenu->reconfigure(); } } else if (pe->atom == xatom->getAtom(XAtom::net_wm_strut)) { updateStrut(); @@ -3116,8 +3079,6 @@ void BlackboxWindow::buttonPressEvent(const XButtonEvent *be) { } else if (frame.stick_button == be->window) { redrawStickyButton(True); } else if (frame.plate == be->window) { - if (windowmenu && windowmenu->isVisible()) windowmenu->hide(); - screen->getWorkspace(blackbox_attrib.workspace)->raiseWindow(this); XAllowEvents(blackbox->getXDisplay(), ReplayPointer, be->time); @@ -3133,58 +3094,12 @@ void BlackboxWindow::buttonPressEvent(const XButtonEvent *be) { } } - if (windowmenu && windowmenu->isVisible()) windowmenu->hide(); - screen->getWorkspace(blackbox_attrib.workspace)->raiseWindow(this); } } else if (be->button == 2 && (be->window != frame.iconify_button) && (be->window != frame.close_button) && (be->window != frame.stick_button)) { screen->getWorkspace(blackbox_attrib.workspace)->lowerWindow(this); - } else if (windowmenu && be->button == 3 && - (frame.title == be->window || frame.label == be->window || - frame.handle == be->window || frame.window == be->window)) { - if (windowmenu->isVisible()) { - windowmenu->hide(); - } else { - int mx = be->x_root - windowmenu->getWidth() / 2, - my = be->y_root - windowmenu->getHeight() / 2; - - // snap the window menu into a corner/side if necessary - int left_edge, right_edge, top_edge, bottom_edge; - - /* - the " + (frame.border_w * 2) - 1" bits are to get the proper width - and height of the menu, as the sizes returned by it do not include - the borders. - */ - left_edge = frame.rect.x(); - right_edge = frame.rect.right() - - (windowmenu->getWidth() + (frame.border_w * 2) - 1); - top_edge = client.rect.top() - (frame.border_w + frame.mwm_border_w); - bottom_edge = client.rect.bottom() - - (windowmenu->getHeight() + (frame.border_w * 2) - 1) + - (frame.border_w + frame.mwm_border_w); - - if (mx < left_edge) - mx = left_edge; - else if (mx > right_edge) - mx = right_edge; - if (my < top_edge) - my = top_edge; - else if (my > bottom_edge) - my = bottom_edge; - - if (my + windowmenu->getHeight() > screen->getHeight()) - my = screen->getHeight() - windowmenu->getHeight() - - (screen->getBorderWidth() * 2); - - windowmenu->move(mx, my); - windowmenu->show(); - XRaiseWindow(blackbox->getXDisplay(), windowmenu->getWindowID()); - XRaiseWindow(blackbox->getXDisplay(), - windowmenu->getSendToMenu()->getWindowID()); - } // mouse wheel up } else if (be->button == 4) { if ((be->window == frame.label || @@ -3276,9 +3191,6 @@ void BlackboxWindow::beginMove(int x_root, int y_root) { GrabModeAsync, GrabModeAsync, None, blackbox->getMoveCursor(), CurrentTime); - if (windowmenu && windowmenu->isVisible()) - windowmenu->hide(); - flags.moving = True; blackbox->setChangingWindow(this); @@ -3431,25 +3343,6 @@ void BlackboxWindow::doWindowSnapping(int &dx, int &dy) { if (*st_it != this) // don't snap to ourself rectlist.push_back( (*st_it)->frameRect() ); - // add the toolbar and the slit to the rect list. - // (only if they are not hidden) - Toolbar *tbar = screen->getToolbar(); - Slit *slit = screen->getSlit(); - Rect tbar_rect, slit_rect; - unsigned int bwidth = screen->getBorderWidth() * 2; - - if (! (screen->doHideToolbar() || tbar->isHidden())) { - tbar_rect.setRect(tbar->getX(), tbar->getY(), tbar->getWidth() + bwidth, - tbar->getHeight() + bwidth); - rectlist.push_back(tbar_rect); - } - - if (! slit->isHidden()) { - slit_rect.setRect(slit->getX(), slit->getY(), slit->getWidth() + bwidth, - slit->getHeight() + bwidth); - rectlist.push_back(slit_rect); - } - RectList::const_iterator it, end = rectlist.end(); for (it = rectlist.begin(); it != end; ++it) { bool snapped = False; diff --git a/src/window.hh b/src/window.hh index e8249b08..a640fcfd 100644 --- a/src/window.hh +++ b/src/window.hh @@ -37,7 +37,6 @@ extern "C" { #include "basedisplay.hh" #include "timer.hh" #include "util.hh" -#include "windowmenu.hh" #define MwmHintsFunctions (1l << 0) #define MwmHintsDecorations (1l << 1) @@ -130,7 +129,6 @@ private: BlackboxAttributes blackbox_attrib; Time lastButtonPressTime; // used for double clicks, when were we clicked - Windowmenu *windowmenu; unsigned int window_number; unsigned long current_state; @@ -290,11 +288,11 @@ private: void redrawWindowFrame(void) const; void redrawLabel(void) const; void redrawAllButtons(void) const; - void BlackboxWindow::redrawButton(bool pressed, Window win, - Pixmap fppix, unsigned long fppixel, - Pixmap uppix, unsigned long uppixel, - Pixmap fpix, unsigned long fpixel, - Pixmap upix, unsigned long upixel) const; + void redrawButton(bool pressed, Window win, + Pixmap fppix, unsigned long fppixel, + Pixmap uppix, unsigned long uppixel, + Pixmap fpix, unsigned long fpixel, + Pixmap upix, unsigned long upixel) const; void redrawCloseButton(bool pressed) const; void redrawIconifyButton(bool pressed) const; void redrawMaximizeButton(bool pressed) const; @@ -353,8 +351,6 @@ public: inline Window getClientWindow(void) const { return client.window; } inline Window getGroupWindow(void) const { return client.window_group; } - inline Windowmenu * getWindowmenu(void) const { return windowmenu; } - inline const char *getTitle(void) const { return client.title.c_str(); } inline const char *getIconTitle(void) const diff --git a/src/workspace.cc b/src/workspace.cc index 8c44adab..995c5005 100644 --- a/src/workspace.cc +++ b/src/workspace.cc @@ -46,15 +46,11 @@ extern "C" { using std::string; #include "blackbox.hh" -#include "clientmenu.hh" #include "font.hh" -#include "netizen.hh" #include "screen.hh" -#include "toolbar.hh" #include "util.hh" #include "window.hh" #include "workspace.hh" -#include "windowmenu.hh" #include "xatom.hh" @@ -69,8 +65,6 @@ Workspace::Workspace(BScreen *scrn, unsigned int i) { id = i; - clientmenu = new Clientmenu(this); - lastfocus = (BlackboxWindow *) 0; readName(); @@ -99,12 +93,6 @@ void Workspace::addWindow(BlackboxWindow *w, bool place, bool sticky) { windowList.push_back(w); - clientmenu->insert(w->getTitle()); - clientmenu->update(); - - if (! sticky) - screen->updateNetizenWindowAdd(w->getClientWindow(), id); - if (screen->doFocusNew() || (w->isTransient() && w->getTransientFor() && w->getTransientFor()->isFocused())) { if (id != screen->getCurrentWorkspaceID()) { @@ -146,12 +134,7 @@ void Workspace::removeWindow(BlackboxWindow *w, bool sticky) { assert(it != end); windowList.erase(it); - clientmenu->remove(i); - clientmenu->update(); - if (! sticky) { - screen->updateNetizenWindowDel(w->getClientWindow()); - BlackboxWindowList::iterator it = windowList.begin(); const BlackboxWindowList::iterator end = windowList.end(); unsigned int i = 0; @@ -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) { while (! windowList.empty()) windowList.front()->iconify(); @@ -296,7 +266,6 @@ void Workspace::raiseTransients(const BlackboxWindow * const win, for (it = win->getTransients().begin(); it != end; ++it) { BlackboxWindow *w = *it; *stack++ = w->getFrameWindow(); - screen->updateNetizenWindowRaise(w->getClientWindow()); if (! w->isIconic()) { Workspace *wkspc = screen->getWorkspace(w->getWorkspaceNumber()); @@ -325,7 +294,6 @@ void Workspace::lowerTransients(const BlackboxWindow * const win, for (it = win->getTransients().rbegin(); it != end; ++it) { BlackboxWindow *w = *it; *stack++ = w->getFrameWindow(); - screen->updateNetizenWindowLower(w->getClientWindow()); if (! w->isIconic()) { Workspace *wkspc = screen->getWorkspace(w->getWorkspaceNumber()); @@ -353,7 +321,6 @@ void Workspace::raiseWindow(BlackboxWindow *w) { StackVector::iterator stack = stack_vector.begin(); *(stack++) = win->getFrameWindow(); - screen->updateNetizenWindowRaise(win->getClientWindow()); if (! (win->isIconic() || win->isDesktop())) { Workspace *wkspc = screen->getWorkspace(win->getWorkspaceNumber()); wkspc->stackingList.remove(win); @@ -383,7 +350,6 @@ void Workspace::lowerWindow(BlackboxWindow *w) { lowerTransients(win, stack); *(stack++) = win->getFrameWindow(); - screen->updateNetizenWindowLower(win->getClientWindow()); if (! (win->isIconic() || win->isDesktop())) { Workspace *wkspc = screen->getWorkspace(win->getWorkspaceNumber()); wkspc->stackingList.remove(win); @@ -395,7 +361,6 @@ void Workspace::lowerWindow(BlackboxWindow *w) { void Workspace::reconfigure(void) { - clientmenu->reconfigure(); std::for_each(windowList.begin(), windowList.end(), 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 { return windowList.size(); } @@ -494,16 +451,13 @@ void Workspace::readName(void) { namesList.size() > id) { name = namesList[id]; - clientmenu->setLabel(name); - clientmenu->update(); } else { /* Use a default name. This doesn't actually change the class. That will happen after the setName changes the root property, and that change makes its way back to this function. */ - string tmp =i18n(WorkspaceSet, WorkspaceDefaultNameFormat, - "Workspace %d"); + string tmp = "Workspace %d"; assert(tmp.length() < 32); char default_name[32]; sprintf(default_name, tmp.c_str(), id + 1); diff --git a/src/workspace.hh b/src/workspace.hh index df0411e1..889d81a3 100644 --- a/src/workspace.hh +++ b/src/workspace.hh @@ -32,11 +32,11 @@ extern "C" { #include #include +#include "xatom.hh" + class BScreen; -class Clientmenu; class Workspace; class BlackboxWindow; -class Netizen; typedef std::list BlackboxWindowList; typedef std::vector StackVector; @@ -45,7 +45,6 @@ class Workspace { private: BScreen *screen; BlackboxWindow *lastfocus; - Clientmenu *clientmenu; XAtom *xatom; BlackboxWindowList stackingList, windowList; @@ -80,8 +79,6 @@ public: inline BlackboxWindow *getLastFocusedWindow(void) { return lastfocus; } - inline Clientmenu *getMenu(void) { return clientmenu; } - inline const std::string& getName(void) const { return name; } inline unsigned int getID(void) const { return id; } @@ -95,9 +92,7 @@ public: BlackboxWindow* getNextWindowInList(BlackboxWindow *w); BlackboxWindow* getPrevWindowInList(BlackboxWindow *w); BlackboxWindow* getTopWindowOnStack(void) const; - void sendWindowList(Netizen &n); void focusFallback(const BlackboxWindow *old_window); - void setFocused(const BlackboxWindow *w, bool focused); bool isCurrent(void) const; bool isLastWindow(const BlackboxWindow* w) const; -- 2.45.2