summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-08-12 03:25:55 (GMT)
committerfluxgen <fluxgen>2002-08-12 03:25:55 (GMT)
commit6051b3a899b8b28a35e47f51831d41489c043415 (patch)
tree728e29a3006af271ffc31311218f51ae29b4e1ab
parentd8ff53979eeff639771bc34b8d8cfc0a96b2737b (diff)
downloadfluxbox_lack-6051b3a899b8b28a35e47f51831d41489c043415.zip
fluxbox_lack-6051b3a899b8b28a35e47f51831d41489c043415.tar.bz2
cleaning and fixed window menu in iconbar
-rw-r--r--src/Toolbar.cc73
1 files changed, 37 insertions, 36 deletions
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index d9932fa..97e31ed 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.cc
@@ -22,20 +22,10 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Toolbar.cc,v 1.26 2002/08/04 15:12:51 fluxgen Exp $ 25// $Id: Toolbar.cc,v 1.27 2002/08/12 03:25:55 fluxgen Exp $
26 26
27#include "Toolbar.hh" 27#include "Toolbar.hh"
28 28
29// stupid macros needed to access some functions in version 2 of the GNU C
30// library
31#ifndef _GNU_SOURCE
32#define _GNU_SOURCE
33#endif // _GNU_SOURCE
34
35#ifdef HAVE_CONFIG_H
36# include "../config.h"
37#endif // HAVE_CONFIG_H
38
39#include "i18n.hh" 29#include "i18n.hh"
40#include "fluxbox.hh" 30#include "fluxbox.hh"
41#include "Clientmenu.hh" 31#include "Clientmenu.hh"
@@ -46,26 +36,31 @@
46#include "Workspace.hh" 36#include "Workspace.hh"
47#include "Workspacemenu.hh" 37#include "Workspacemenu.hh"
48 38
39// use GNU extensions
40#ifndef _GNU_SOURCE
41#define _GNU_SOURCE
42#endif // _GNU_SOURCE
43
44#ifdef HAVE_CONFIG_H
45# include "../config.h"
46#endif // HAVE_CONFIG_H
47
49#include <X11/Xutil.h> 48#include <X11/Xutil.h>
50#include <X11/keysym.h> 49#include <X11/keysym.h>
51 50
52#ifdef STDC_HEADERS
53# include <string.h>
54#endif // STDC_HEADERS
55 51
56#ifdef HAVE_STDIO_H 52#include <cstring>
57# include <stdio.h> 53#include <cstdio>
58#endif // HAVE_STDIO_H
59 54
60#ifdef TIME_WITH_SYS_TIME 55#ifdef TIME_WITH_SYS_TIME
61# include <sys/time.h> 56#include <sys/time.h>
62# include <time.h> 57#include <time.h>
63#else // !TIME_WITH_SYS_TIME 58#else // !TIME_WITH_SYS_TIME
64# ifdef HAVE_SYS_TIME_H 59#ifdef HAVE_SYS_TIME_H
65# include <sys/time.h> 60#include <sys/time.h>
66# else // !HAVE_SYS_TIME_H 61#else // !HAVE_SYS_TIME_H
67# include <time.h> 62#include <time.h>
68# endif // HAVE_SYS_TIME_H 63#endif // HAVE_SYS_TIME_H
69#endif // TIME_WITH_SYS_TIME 64#endif // TIME_WITH_SYS_TIME
70 65
71#include <iostream> 66#include <iostream>
@@ -1031,7 +1026,11 @@ void Toolbar::buttonPressEvent(XButtonEvent *be) {
1031 } else if (be->button == 2 && (! on_top)) { 1026 } else if (be->button == 2 && (! on_top)) {
1032 XLowerWindow(display, frame.window); 1027 XLowerWindow(display, frame.window);
1033 } else if (be->button == 3) { 1028 } else if (be->button == 3) {
1034 if (! toolbarmenu->isVisible()) { 1029 FluxboxWindow *fluxboxwin = 0;
1030 if ( iconbar && (fluxboxwin = iconbar->findWindow(be->window)) ) {
1031 Windowmenu *wm = fluxboxwin->getWindowmenu();
1032 fluxboxwin->showMenu(be->x_root, be->y_root - wm->height());
1033 } else if (! toolbarmenu->isVisible()) {
1035 int x, y; 1034 int x, y;
1036 1035
1037 x = be->x_root - (toolbarmenu->width() / 2); 1036 x = be->x_root - (toolbarmenu->width() / 2);
@@ -1173,13 +1172,14 @@ void Toolbar::keyPressEvent(XKeyEvent *ke) {
1173 //save workspace names 1172 //save workspace names
1174 Fluxbox::instance()->save_rc(); 1173 Fluxbox::instance()->save_rc();
1175 1174
1176 } else if (! (ks == XK_Shift_L || ks == XK_Shift_R || 1175 } else if (! IsModifierKey(ks)) {/* ks == XK_Shift_L || ks == XK_Shift_R ||
1177 ks == XK_Control_L || ks == XK_Control_R || 1176 ks == XK_Control_L || ks == XK_Control_R ||
1178 ks == XK_Caps_Lock || ks == XK_Shift_Lock || 1177 ks == XK_Caps_Lock || ks == XK_Shift_Lock ||
1179 ks == XK_Meta_L || ks == XK_Meta_R || 1178 ks == XK_Meta_L || ks == XK_Meta_R ||
1180 ks == XK_Alt_L || ks == XK_Alt_R || 1179 ks == XK_Alt_L || ks == XK_Alt_R ||
1181 ks == XK_Super_L || ks == XK_Super_R || 1180 ks == XK_Super_L || ks == XK_Super_R ||
1182 ks == XK_Hyper_L || ks == XK_Hyper_R)) { 1181 ks == XK_Hyper_L || ks == XK_Hyper_R)) {
1182 */
1183 1183
1184 if (ks == XK_BackSpace && new_workspace_name.size()) 1184 if (ks == XK_BackSpace && new_workspace_name.size())
1185 new_workspace_name.erase(new_workspace_name.size()-1); 1185 new_workspace_name.erase(new_workspace_name.size()-1);
@@ -1196,26 +1196,26 @@ void Toolbar::keyPressEvent(XKeyEvent *ke) {
1196 XmbTextExtents(screen->getToolbarStyle()->font.set, 1196 XmbTextExtents(screen->getToolbarStyle()->font.set,
1197 new_workspace_name.c_str(), l, &ink, &logical); 1197 new_workspace_name.c_str(), l, &ink, &logical);
1198 tw = logical.width; 1198 tw = logical.width;
1199 } else 1199 } else {
1200 tw = XTextWidth(screen->getToolbarStyle()->font.fontstruct, 1200 tw = XTextWidth(screen->getToolbarStyle()->font.fontstruct,
1201 new_workspace_name.c_str(), l); 1201 new_workspace_name.c_str(), l);
1202 1202 }
1203 x = (frame.workspace_label_w - tw) / 2; 1203 x = (frame.workspace_label_w - tw) / 2;
1204 1204
1205 if (x < (signed) frame.bevel_w) x = frame.bevel_w; 1205 if (x < (signed) frame.bevel_w) x = frame.bevel_w;
1206 1206
1207 if (i18n->multibyte()) 1207 if (i18n->multibyte()) {
1208 XmbDrawString(display, frame.workspace_label, 1208 XmbDrawString(display, frame.workspace_label,
1209 screen->getWindowStyle()->font.set, 1209 screen->getWindowStyle()->font.set,
1210 screen->getWindowStyle()->l_text_focus_gc, x, 1 - 1210 screen->getWindowStyle()->l_text_focus_gc, x, 1 -
1211 screen->getWindowStyle()->font.set_extents->max_ink_extent.y, 1211 screen->getWindowStyle()->font.set_extents->max_ink_extent.y,
1212 new_workspace_name.c_str(), l); 1212 new_workspace_name.c_str(), l);
1213 else 1213 } else {
1214 XDrawString(display, frame.workspace_label, 1214 XDrawString(display, frame.workspace_label,
1215 screen->getWindowStyle()->l_text_focus_gc, x, 1215 screen->getWindowStyle()->l_text_focus_gc, x,
1216 screen->getToolbarStyle()->font.fontstruct->ascent + 1, 1216 screen->getToolbarStyle()->font.fontstruct->ascent + 1,
1217 new_workspace_name.c_str(), l); 1217 new_workspace_name.c_str(), l);
1218 1218 }
1219 XDrawRectangle(display, frame.workspace_label, 1219 XDrawRectangle(display, frame.workspace_label,
1220 screen->getWindowStyle()->l_text_focus_gc, x + tw, 0, 1, 1220 screen->getWindowStyle()->l_text_focus_gc, x + tw, 0, 1,
1221 frame.label_h - 1); 1221 frame.label_h - 1);
@@ -1308,7 +1308,8 @@ Toolbarmenu::~Toolbarmenu() {
1308void Toolbarmenu::itemSelected(int button, unsigned int index) { 1308void Toolbarmenu::itemSelected(int button, unsigned int index) {
1309 if (button == 1) { 1309 if (button == 1) {
1310 BasemenuItem *item = find(index); 1310 BasemenuItem *item = find(index);
1311 if (! item) return; 1311 if (item == 0)
1312 return;
1312 1313
1313 switch (item->function()) { 1314 switch (item->function()) {
1314 case 1: {// always on top 1315 case 1: {// always on top
@@ -1330,9 +1331,9 @@ void Toolbarmenu::itemSelected(int button, unsigned int index) {
1330 screen()->saveToolbarAutoHide(toolbar->do_auto_hide); 1331 screen()->saveToolbarAutoHide(toolbar->do_auto_hide);
1331 setItemSelected(2, change); 1332 setItemSelected(2, change);
1332 1333
1333 #ifdef SLIT 1334#ifdef SLIT
1334 toolbar->screen->getSlit()->reposition(); 1335 toolbar->screen->getSlit()->reposition();
1335 #endif // SLIT 1336#endif // SLIT
1336 Fluxbox::instance()->save_rc(); 1337 Fluxbox::instance()->save_rc();
1337 break; 1338 break;
1338 } 1339 }