aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-04-09 23:16:28 (GMT)
committerfluxgen <fluxgen>2002-04-09 23:16:28 (GMT)
commit8afd178252147739025779bc8db906cabea488fe (patch)
tree421ab302e4378bb66c322255794dd99733541190
parent113a43bd706f506737eabcbd133cc24b5fa47b27 (diff)
downloadfluxbox-8afd178252147739025779bc8db906cabea488fe.zip
fluxbox-8afd178252147739025779bc8db906cabea488fe.tar.bz2
update from Workspace changes and removed grab/ungrab
-rw-r--r--src/Toolbar.cc47
1 files changed, 22 insertions, 25 deletions
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index 389b6db..cdeac65 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.cc
@@ -22,7 +22,7 @@
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.20 2002/04/08 22:30:51 fluxgen Exp $ 25// $Id: Toolbar.cc,v 1.21 2002/04/09 23:16:28 fluxgen Exp $
26 26
27// stupid macros needed to access some functions in version 2 of the GNU C 27// stupid macros needed to access some functions in version 2 of the GNU C
28// library 28// library
@@ -374,14 +374,14 @@ void Toolbar::reconfigure(void) {
374 if (i18n->multibyte()) { 374 if (i18n->multibyte()) {
375 XRectangle ink, logical; 375 XRectangle ink, logical;
376 XmbTextExtents(screen->getToolbarStyle()->font.set, 376 XmbTextExtents(screen->getToolbarStyle()->font.set,
377 screen->getWorkspace(i)->getName(), 377 screen->getWorkspace(i)->name().c_str(),
378 strlen(screen->getWorkspace(i)->getName()), 378 screen->getWorkspace(i)->name().size(),
379 &ink, &logical); 379 &ink, &logical);
380 w = logical.width; 380 w = logical.width;
381 } else 381 } else
382 w = XTextWidth(screen->getToolbarStyle()->font.fontstruct, 382 w = XTextWidth(screen->getToolbarStyle()->font.fontstruct,
383 screen->getWorkspace(i)->getName(), 383 screen->getWorkspace(i)->name().c_str(),
384 strlen(screen->getWorkspace(i)->getName())); 384 screen->getWorkspace(i)->name().size());
385 385
386 w += (frame.bevel_w * 4); 386 w += (frame.bevel_w * 4);
387 387
@@ -786,7 +786,7 @@ void Toolbar::redrawWindowLabel(Bool redraw) {
786 786
787 787
788void Toolbar::redrawWorkspaceLabel(Bool redraw) { 788void Toolbar::redrawWorkspaceLabel(Bool redraw) {
789 if (screen->getCurrentWorkspace()->getName()) { 789 if (screen->getCurrentWorkspace()->name().size()>0) {
790 790
791 if (redraw) 791 if (redraw)
792 XClearWindow(display, frame.workspace_label); 792 XClearWindow(display, frame.workspace_label);
@@ -795,10 +795,10 @@ void Toolbar::redrawWorkspaceLabel(Bool redraw) {
795 &screen->getToolbarStyle()->font, 795 &screen->getToolbarStyle()->font,
796 frame.workspace_label_w, frame.width, 796 frame.workspace_label_w, frame.width,
797 frame.bevel_w, 797 frame.bevel_w,
798 const_cast<char *>(screen->getCurrentWorkspace()->getName()));*/ 798 const_cast<char *>(screen->getCurrentWorkspace()->name().c_str()));*/
799 799
800 int dx = (frame.bevel_w * 2), dlen = 800 int dx = (frame.bevel_w * 2), dlen =
801 strlen(screen->getCurrentWorkspace()->getName()); 801 screen->getCurrentWorkspace()->name().size();
802 unsigned int l; 802 unsigned int l;
803 I18n *i18n = I18n::instance(); 803 I18n *i18n = I18n::instance();
804 804
@@ -806,12 +806,12 @@ void Toolbar::redrawWorkspaceLabel(Bool redraw) {
806 if (i18n->multibyte()) { 806 if (i18n->multibyte()) {
807 XRectangle ink, logical; 807 XRectangle ink, logical;
808 XmbTextExtents(screen->getToolbarStyle()->font.set, 808 XmbTextExtents(screen->getToolbarStyle()->font.set,
809 screen->getCurrentWorkspace()->getName(), dlen, 809 screen->getCurrentWorkspace()->name().c_str(), dlen,
810 &ink, &logical); 810 &ink, &logical);
811 l = logical.width; 811 l = logical.width;
812 } else 812 } else
813 l = XTextWidth(screen->getToolbarStyle()->font.fontstruct, 813 l = XTextWidth(screen->getToolbarStyle()->font.fontstruct,
814 screen->getCurrentWorkspace()->getName(), dlen); 814 screen->getCurrentWorkspace()->name().c_str(), dlen);
815 815
816 l += (frame.bevel_w * 4); 816 l += (frame.bevel_w * 4);
817 817
@@ -820,12 +820,12 @@ void Toolbar::redrawWorkspaceLabel(Bool redraw) {
820 if (i18n->multibyte()) { 820 if (i18n->multibyte()) {
821 XRectangle ink, logical; 821 XRectangle ink, logical;
822 XmbTextExtents(screen->getToolbarStyle()->font.set, 822 XmbTextExtents(screen->getToolbarStyle()->font.set,
823 screen->getCurrentWorkspace()->getName(), dlen, 823 screen->getCurrentWorkspace()->name().c_str(), dlen,
824 &ink, &logical); 824 &ink, &logical);
825 l = logical.width; 825 l = logical.width;
826 } else { 826 } else {
827 l = XTextWidth(screen->getWindowStyle()->font.fontstruct, 827 l = XTextWidth(screen->getWindowStyle()->font.fontstruct,
828 screen->getCurrentWorkspace()->getName(), dlen); 828 screen->getCurrentWorkspace()->name().c_str(), dlen);
829 } 829 }
830 830
831 l += (frame.bevel_w * 4); 831 l += (frame.bevel_w * 4);
@@ -852,12 +852,12 @@ void Toolbar::redrawWorkspaceLabel(Bool redraw) {
852 screen->getToolbarStyle()->font.set, 852 screen->getToolbarStyle()->font.set,
853 screen->getToolbarStyle()->l_text_gc, dx, 1 - 853 screen->getToolbarStyle()->l_text_gc, dx, 1 -
854 screen->getToolbarStyle()->font.set_extents->max_ink_extent.y, 854 screen->getToolbarStyle()->font.set_extents->max_ink_extent.y,
855 (char *) screen->getCurrentWorkspace()->getName(), dlen); 855 (char *) screen->getCurrentWorkspace()->name().c_str(), dlen);
856 } else { 856 } else {
857 XDrawString(display, frame.workspace_label, 857 XDrawString(display, frame.workspace_label,
858 screen->getToolbarStyle()->l_text_gc, dx, 858 screen->getToolbarStyle()->l_text_gc, dx,
859 screen->getToolbarStyle()->font.fontstruct->ascent + 1, 859 screen->getToolbarStyle()->font.fontstruct->ascent + 1,
860 (char *) screen->getCurrentWorkspace()->getName(), dlen); 860 (char *) screen->getCurrentWorkspace()->name().c_str(), dlen);
861 } 861 }
862 } 862 }
863} 863}
@@ -1138,9 +1138,7 @@ void Toolbar::exposeEvent(XExposeEvent *ee) {
1138 1138
1139void Toolbar::keyPressEvent(XKeyEvent *ke) { 1139void Toolbar::keyPressEvent(XKeyEvent *ke) {
1140 if (ke->window == frame.workspace_label && editing) { 1140 if (ke->window == frame.workspace_label && editing) {
1141 BaseDisplay::GrabGuard gg(*fluxbox); 1141
1142 fluxbox->grab();
1143
1144 KeySym ks; 1142 KeySym ks;
1145 char keychar[1]; 1143 char keychar[1];
1146 XLookupString(ke, keychar, 1, &ks, 0); 1144 XLookupString(ke, keychar, 1, &ks, 0);
@@ -1158,17 +1156,17 @@ void Toolbar::keyPressEvent(XKeyEvent *ke) {
1158 XSetInputFocus(display, PointerRoot, None, CurrentTime); 1156 XSetInputFocus(display, PointerRoot, None, CurrentTime);
1159 1157
1160 if (ks == XK_Return) //change workspace name if keypress = Return 1158 if (ks == XK_Return) //change workspace name if keypress = Return
1161 screen->getCurrentWorkspace()->setName(const_cast<char *>(new_workspace_name.c_str())); 1159 screen->getCurrentWorkspace()->setName(new_workspace_name.c_str());
1162 1160
1163 new_workspace_name.erase(); //erase temporary workspace name 1161 new_workspace_name.erase(); //erase temporary workspace name
1164 1162
1165 screen->getCurrentWorkspace()->getMenu()->hide(); 1163 screen->getCurrentWorkspace()->menu()->hide();
1166 screen->getWorkspacemenu()-> 1164 screen->getWorkspacemenu()->
1167 remove(screen->getCurrentWorkspace()->getWorkspaceID() + 2); 1165 remove(screen->getCurrentWorkspace()->workspaceID() + 2);
1168 screen->getWorkspacemenu()-> 1166 screen->getWorkspacemenu()->
1169 insert(screen->getCurrentWorkspace()->getName(), 1167 insert(screen->getCurrentWorkspace()->name().c_str(),
1170 screen->getCurrentWorkspace()->getMenu(), 1168 screen->getCurrentWorkspace()->menu(),
1171 screen->getCurrentWorkspace()->getWorkspaceID() + 1); 1169 screen->getCurrentWorkspace()->workspaceID() + 1);
1172 screen->getWorkspacemenu()->update(); 1170 screen->getWorkspacemenu()->update();
1173 1171
1174 reconfigure(); 1172 reconfigure();
@@ -1218,9 +1216,8 @@ void Toolbar::keyPressEvent(XKeyEvent *ke) {
1218 XDrawRectangle(display, frame.workspace_label, 1216 XDrawRectangle(display, frame.workspace_label,
1219 screen->getWindowStyle()->l_text_focus_gc, x + tw, 0, 1, 1217 screen->getWindowStyle()->l_text_focus_gc, x + tw, 0, 1,
1220 frame.label_h - 1); 1218 frame.label_h - 1);
1221 } 1219 }
1222 1220
1223 fluxbox->ungrab();
1224 } 1221 }
1225} 1222}
1226 1223