diff options
author | markt <markt> | 2007-03-25 06:53:09 (GMT) |
---|---|---|
committer | markt <markt> | 2007-03-25 06:53:09 (GMT) |
commit | cd28ddec7b719fd10f5b7740cf25fa77891526ae (patch) | |
tree | 2c033a9a7c6c8edec38d3ee85d6be67e8efe6128 | |
parent | af76b920415642fa04ee32fa1c621e8b36888842 (diff) | |
download | fluxbox-cd28ddec7b719fd10f5b7740cf25fa77891526ae.zip fluxbox-cd28ddec7b719fd10f5b7740cf25fa77891526ae.tar.bz2 |
added session.screen0.tabs.usePixmap
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/FbWinFrame.cc | 15 | ||||
-rw-r--r-- | src/FbWinFrame.hh | 10 | ||||
-rw-r--r-- | src/FocusControl.cc | 3 | ||||
-rw-r--r-- | src/Screen.cc | 1 | ||||
-rw-r--r-- | src/Screen.hh | 2 | ||||
-rw-r--r-- | src/WinClient.cc | 4 | ||||
-rw-r--r-- | src/Window.cc | 37 | ||||
-rw-r--r-- | src/Window.hh | 3 |
9 files changed, 37 insertions, 42 deletions
@@ -1,5 +1,9 @@ | |||
1 | (Format: Year/Month/Day) | 1 | (Format: Year/Month/Day) |
2 | Changes for 1.1: | 2 | Changes for 1.1: |
3 | *07/03/25: | ||
4 | * Added new resource session.screen<N>.tabs.usePixmap that puts the window's | ||
5 | icon in the tab, if available. This is on by default. (Mark) | ||
6 | Window.cc FbWinFrame.cc/hh WinClient.cc Screen.cc/hh | ||
3 | *07/03/24: | 7 | *07/03/24: |
4 | * Updated French translations (thanks Ulrich Etile) | 8 | * Updated French translations (thanks Ulrich Etile) |
5 | nls/fr_FR/Translation.m | 9 | nls/fr_FR/Translation.m |
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index 99dd93d..84f47f4 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "FbWinFrameTheme.hh" | 33 | #include "FbWinFrameTheme.hh" |
34 | #include "Screen.hh" | 34 | #include "Screen.hh" |
35 | 35 | ||
36 | #include "IconButton.hh" | ||
36 | #include "Container.hh" | 37 | #include "Container.hh" |
37 | 38 | ||
38 | #ifdef SHAPE | 39 | #ifdef SHAPE |
@@ -619,11 +620,9 @@ void FbWinFrame::removeAllButtons() { | |||
619 | } | 620 | } |
620 | } | 621 | } |
621 | 622 | ||
622 | FbWinFrame::ButtonId FbWinFrame::createTab(const string &title, FbTk::Command *command, | 623 | IconButton *FbWinFrame::createTab(Focusable &client) { |
623 | int tabs_padding) { | 624 | IconButton *button = new IconButton(m_tab_container, theme().font(), |
624 | FbTk::TextButton *button = new FbTk::TextButton(m_tab_container, | 625 | client); |
625 | theme().font(), | ||
626 | title); | ||
627 | 626 | ||
628 | button->show(); | 627 | button->show(); |
629 | button->setEventMask(ExposureMask | ButtonPressMask | | 628 | button->setEventMask(ExposureMask | ButtonPressMask | |
@@ -631,10 +630,6 @@ FbWinFrame::ButtonId FbWinFrame::createTab(const string &title, FbTk::Command *c | |||
631 | EnterWindowMask); | 630 | EnterWindowMask); |
632 | FbTk::EventManager::instance()->add(*button, button->window()); | 631 | FbTk::EventManager::instance()->add(*button, button->window()); |
633 | 632 | ||
634 | FbTk::RefCount<FbTk::Command> refcmd(command); | ||
635 | button->setOnClick(refcmd); | ||
636 | |||
637 | button->setTextPadding(tabs_padding); | ||
638 | button->setJustify(theme().justify()); | 633 | button->setJustify(theme().justify()); |
639 | button->setBorderColor(theme().border().color()); | 634 | button->setBorderColor(theme().border().color()); |
640 | button->setBorderWidth(m_window.borderWidth()); | 635 | button->setBorderWidth(m_window.borderWidth()); |
@@ -647,7 +642,7 @@ FbWinFrame::ButtonId FbWinFrame::createTab(const string &title, FbTk::Command *c | |||
647 | return button; | 642 | return button; |
648 | } | 643 | } |
649 | 644 | ||
650 | void FbWinFrame::removeTab(ButtonId btn) { | 645 | void FbWinFrame::removeTab(IconButton *btn) { |
651 | if (btn == m_current_label) | 646 | if (btn == m_current_label) |
652 | m_current_label = 0; | 647 | m_current_label = 0; |
653 | 648 | ||
diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh index 182add4..a75d8a1 100644 --- a/src/FbWinFrame.hh +++ b/src/FbWinFrame.hh | |||
@@ -42,6 +42,8 @@ | |||
42 | class Shape; | 42 | class Shape; |
43 | class FbWinFrameTheme; | 43 | class FbWinFrameTheme; |
44 | class BScreen; | 44 | class BScreen; |
45 | class IconButton; | ||
46 | class Focusable; | ||
45 | 47 | ||
46 | namespace FbTk { | 48 | namespace FbTk { |
47 | class TextButton; | 49 | class TextButton; |
@@ -70,8 +72,6 @@ public: | |||
70 | }; | 72 | }; |
71 | 73 | ||
72 | 74 | ||
73 | typedef FbTk::TextButton *ButtonId; ///< defines a button id | ||
74 | |||
75 | /// create a top level window | 75 | /// create a top level window |
76 | FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl, | 76 | FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl, |
77 | FbTk::XLayer &layer, | 77 | FbTk::XLayer &layer, |
@@ -141,10 +141,9 @@ public: | |||
141 | /// remove all buttons from titlebar | 141 | /// remove all buttons from titlebar |
142 | void removeAllButtons(); | 142 | void removeAllButtons(); |
143 | /// adds a button to label window with specified title and command | 143 | /// adds a button to label window with specified title and command |
144 | ButtonId createTab(const std::string &title, FbTk::Command *cmd, int tab_padding); | 144 | IconButton *createTab(Focusable &client); |
145 | // void addLabelButton(FbTk::TextButton &btn); | ||
146 | /// removes a specific button from label window | 145 | /// removes a specific button from label window |
147 | void removeTab(ButtonId id); | 146 | void removeTab(IconButton *id); |
148 | /// move label button to the left | 147 | /// move label button to the left |
149 | void moveLabelButtonLeft(FbTk::TextButton &btn); | 148 | void moveLabelButtonLeft(FbTk::TextButton &btn); |
150 | /// move label button to the right | 149 | /// move label button to the right |
@@ -322,7 +321,6 @@ private: | |||
322 | m_buttons_right; ///< buttons to the right | 321 | m_buttons_right; ///< buttons to the right |
323 | typedef std::list<FbTk::TextButton *> LabelList; | 322 | typedef std::list<FbTk::TextButton *> LabelList; |
324 | FbTk::TextButton *m_current_label; ///< which client button is focused at the moment | 323 | FbTk::TextButton *m_current_label; ///< which client button is focused at the moment |
325 | std::string m_titletext; ///< text to be displayed int m_label | ||
326 | int m_bevel; ///< bevel between titlebar items and titlebar | 324 | int m_bevel; ///< bevel between titlebar items and titlebar |
327 | bool m_use_titlebar; ///< if we should use titlebar | 325 | bool m_use_titlebar; ///< if we should use titlebar |
328 | bool m_use_tabs; ///< if we should use tabs (turns them off in external mode only) | 326 | bool m_use_tabs; ///< if we should use tabs (turns them off in external mode only) |
diff --git a/src/FocusControl.cc b/src/FocusControl.cc index e653e22..71b289b 100644 --- a/src/FocusControl.cc +++ b/src/FocusControl.cc | |||
@@ -291,7 +291,8 @@ Focusable *FocusControl::lastFocusedWindow(int workspace) { | |||
291 | * Stuck, iconic etc don't matter within a group | 291 | * Stuck, iconic etc don't matter within a group |
292 | */ | 292 | */ |
293 | WinClient *FocusControl::lastFocusedWindow(FluxboxWindow &group, WinClient *ignore_client) { | 293 | WinClient *FocusControl::lastFocusedWindow(FluxboxWindow &group, WinClient *ignore_client) { |
294 | if (m_focused_list.empty()) return 0; | 294 | if (m_focused_list.empty() || m_screen.isShuttingdown()) |
295 | return 0; | ||
295 | 296 | ||
296 | Focusables::iterator it = m_focused_list.begin(); | 297 | Focusables::iterator it = m_focused_list.begin(); |
297 | Focusables::iterator it_end = m_focused_list.end(); | 298 | Focusables::iterator it_end = m_focused_list.end(); |
diff --git a/src/Screen.cc b/src/Screen.cc index fca932d..a0bc01d 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -325,6 +325,7 @@ BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm, | |||
325 | altscrname+".overlay.CapStyle"), | 325 | altscrname+".overlay.CapStyle"), |
326 | scroll_action(rm, "", scrname+".windowScrollAction", altscrname+".WindowScrollAction"), | 326 | scroll_action(rm, "", scrname+".windowScrollAction", altscrname+".WindowScrollAction"), |
327 | scroll_reverse(rm, false, scrname+".windowScrollReverse", altscrname+".WindowScrollReverse"), | 327 | scroll_reverse(rm, false, scrname+".windowScrollReverse", altscrname+".WindowScrollReverse"), |
328 | tabs_use_pixmap(rm, true, scrname+".tabs.usePixmap", altscrname+".Tabs.UsePixmap"), | ||
328 | max_over_tabs(rm, false, scrname+".tabs.maxOver", altscrname+".Tabs.MaxOver"), | 329 | max_over_tabs(rm, false, scrname+".tabs.maxOver", altscrname+".Tabs.MaxOver"), |
329 | default_internal_tabs(rm, false /* TODO: autoconf option? */ , scrname+".tabs.intitlebar", altscrname+".Tabs.InTitlebar") { | 330 | default_internal_tabs(rm, false /* TODO: autoconf option? */ , scrname+".tabs.intitlebar", altscrname+".Tabs.InTitlebar") { |
330 | 331 | ||
diff --git a/src/Screen.hh b/src/Screen.hh index 352a015..53198fc 100644 --- a/src/Screen.hh +++ b/src/Screen.hh | |||
@@ -147,6 +147,7 @@ public: | |||
147 | inline const std::string &getScrollAction() const { return *resource.scroll_action; } | 147 | inline const std::string &getScrollAction() const { return *resource.scroll_action; } |
148 | inline const bool getScrollReverse() const { return *resource.scroll_reverse; } | 148 | inline const bool getScrollReverse() const { return *resource.scroll_reverse; } |
149 | inline const bool getDefaultInternalTabs() const { return *resource.default_internal_tabs; } | 149 | inline const bool getDefaultInternalTabs() const { return *resource.default_internal_tabs; } |
150 | inline const bool getTabsUsePixmap() const { return *resource.tabs_use_pixmap; } | ||
150 | inline const bool getMaxOverTabs() const { return *resource.max_over_tabs; } | 151 | inline const bool getMaxOverTabs() const { return *resource.max_over_tabs; } |
151 | 152 | ||
152 | inline unsigned int getTabWidth() const { return *resource.tab_width; } | 153 | inline unsigned int getTabWidth() const { return *resource.tab_width; } |
@@ -468,6 +469,7 @@ private: | |||
468 | FbTk::Resource<FbTk::GContext::CapStyle> gc_cap_style; | 469 | FbTk::Resource<FbTk::GContext::CapStyle> gc_cap_style; |
469 | FbTk::Resource<std::string> scroll_action; | 470 | FbTk::Resource<std::string> scroll_action; |
470 | FbTk::Resource<bool> scroll_reverse; | 471 | FbTk::Resource<bool> scroll_reverse; |
472 | FbTk::Resource<bool> tabs_use_pixmap; | ||
471 | FbTk::Resource<bool> max_over_tabs; | 473 | FbTk::Resource<bool> max_over_tabs; |
472 | FbTk::Resource<bool> default_internal_tabs; | 474 | FbTk::Resource<bool> default_internal_tabs; |
473 | 475 | ||
diff --git a/src/WinClient.cc b/src/WinClient.cc index 6ede82c..4e491f0 100644 --- a/src/WinClient.cc +++ b/src/WinClient.cc | |||
@@ -353,11 +353,15 @@ void WinClient::updateTitle() { | |||
353 | return; | 353 | return; |
354 | 354 | ||
355 | m_title = string(Xutil::getWMName(window()), 0, 512); | 355 | m_title = string(Xutil::getWMName(window()), 0, 512); |
356 | titleSig().notify(); | ||
357 | if (fbwindow()) | ||
358 | fbwindow()->updateTitleFromClient(*this); | ||
356 | } | 359 | } |
357 | 360 | ||
358 | void WinClient::setTitle(FbTk::FbString &title) { | 361 | void WinClient::setTitle(FbTk::FbString &title) { |
359 | m_title = title; | 362 | m_title = title; |
360 | m_title_override = true; | 363 | m_title_override = true; |
364 | titleSig().notify(); | ||
361 | if (fbwindow()) | 365 | if (fbwindow()) |
362 | fbwindow()->updateTitleFromClient(*this); | 366 | fbwindow()->updateTitleFromClient(*this); |
363 | } | 367 | } |
diff --git a/src/Window.cc b/src/Window.cc index ce14d08..560bf96 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -42,8 +42,8 @@ | |||
42 | #include "StringUtil.hh" | 42 | #include "StringUtil.hh" |
43 | #include "FocusControl.hh" | 43 | #include "FocusControl.hh" |
44 | #include "Layer.hh" | 44 | #include "Layer.hh" |
45 | #include "IconButton.hh" | ||
45 | 46 | ||
46 | #include "FbTk/TextButton.hh" | ||
47 | #include "FbTk/Compose.hh" | 47 | #include "FbTk/Compose.hh" |
48 | #include "FbTk/EventManager.hh" | 48 | #include "FbTk/EventManager.hh" |
49 | #include "FbTk/KeyUtil.hh" | 49 | #include "FbTk/KeyUtil.hh" |
@@ -739,7 +739,7 @@ bool FluxboxWindow::removeClient(WinClient &client) { | |||
739 | FbTk::EventManager &evm = *FbTk::EventManager::instance(); | 739 | FbTk::EventManager &evm = *FbTk::EventManager::instance(); |
740 | evm.remove(client.window()); | 740 | evm.remove(client.window()); |
741 | 741 | ||
742 | FbTk::TextButton *label_btn = m_labelbuttons[&client]; | 742 | IconButton *label_btn = m_labelbuttons[&client]; |
743 | if (label_btn != 0) { | 743 | if (label_btn != 0) { |
744 | frame().removeTab(label_btn); | 744 | frame().removeTab(label_btn); |
745 | label_btn = 0; | 745 | label_btn = 0; |
@@ -1015,8 +1015,8 @@ void FluxboxWindow::associateClientWindow(bool use_attrs, | |||
1015 | int x, int y, | 1015 | int x, int y, |
1016 | unsigned int width, unsigned int height, | 1016 | unsigned int width, unsigned int height, |
1017 | int gravity, unsigned int client_bw) { | 1017 | int gravity, unsigned int client_bw) { |
1018 | updateTitleFromClient(*m_client); | 1018 | m_client->updateTitle(); |
1019 | updateIconNameFromClient(*m_client); | 1019 | m_client->updateIconTitle(); |
1020 | 1020 | ||
1021 | if (use_attrs) | 1021 | if (use_attrs) |
1022 | frame().moveResizeForClient(x, y, | 1022 | frame().moveResizeForClient(x, y, |
@@ -1099,21 +1099,12 @@ void FluxboxWindow::reconfigure() { | |||
1099 | 1099 | ||
1100 | /// update current client title and title in our frame | 1100 | /// update current client title and title in our frame |
1101 | void FluxboxWindow::updateTitleFromClient(WinClient &client) { | 1101 | void FluxboxWindow::updateTitleFromClient(WinClient &client) { |
1102 | client.updateTitle(); | 1102 | if (&client == m_client) { |
1103 | // compare old title with new and see if we need to update | 1103 | frame().setFocusTitle(client.title()); |
1104 | // graphics | 1104 | titleSig().notify(); |
1105 | if (m_labelbuttons[&client]->text() != client.title()) { | ||
1106 | m_labelbuttons[&client]->setText(client.title()); | ||
1107 | if (&client == m_client) | ||
1108 | frame().setFocusTitle(client.title()); | ||
1109 | } | 1105 | } |
1110 | } | 1106 | } |
1111 | 1107 | ||
1112 | /// update icon title from client | ||
1113 | void FluxboxWindow::updateIconNameFromClient(WinClient &client) { | ||
1114 | client.updateIconTitle(); | ||
1115 | } | ||
1116 | |||
1117 | void FluxboxWindow::updateMWMHintsFromClient(WinClient &client) { | 1108 | void FluxboxWindow::updateMWMHintsFromClient(WinClient &client) { |
1118 | const WinClient::MwmHints *hint = client.getMwmHint(); | 1109 | const WinClient::MwmHints *hint = client.getMwmHint(); |
1119 | 1110 | ||
@@ -2457,8 +2448,7 @@ void FluxboxWindow::propertyNotifyEvent(WinClient &client, Atom atom) { | |||
2457 | // update icon title and then do normal XA_WM_NAME stuff | 2448 | // update icon title and then do normal XA_WM_NAME stuff |
2458 | client.updateIconTitle(); | 2449 | client.updateIconTitle(); |
2459 | case XA_WM_NAME: | 2450 | case XA_WM_NAME: |
2460 | updateTitleFromClient(client); | 2451 | client.updateTitle(); |
2461 | titleSig().notify(); | ||
2462 | break; | 2452 | break; |
2463 | 2453 | ||
2464 | case XA_WM_NORMAL_HINTS: { | 2454 | case XA_WM_NORMAL_HINTS: { |
@@ -4191,13 +4181,14 @@ void FluxboxWindow::ungrabPointer(Time time) { | |||
4191 | 4181 | ||
4192 | void FluxboxWindow::associateClient(WinClient &client) { | 4182 | void FluxboxWindow::associateClient(WinClient &client) { |
4193 | 4183 | ||
4194 | FbWinFrame::ButtonId btn = frame().createTab(client.title(), | 4184 | IconButton *btn = frame().createTab(client); |
4195 | new SetClientCmd(client), | ||
4196 | Fluxbox::instance()->getTabsPadding()); | ||
4197 | |||
4198 | m_labelbuttons[&client] = btn; | ||
4199 | 4185 | ||
4186 | FbTk::RefCount<FbTk::Command> setcmd(new SetClientCmd(client)); | ||
4187 | btn->setOnClick(setcmd, 1); | ||
4188 | btn->setTextPadding(Fluxbox::instance()->getTabsPadding()); | ||
4189 | btn->setPixmap(screen().getTabsUsePixmap()); | ||
4200 | 4190 | ||
4191 | m_labelbuttons[&client] = btn; | ||
4201 | 4192 | ||
4202 | FbTk::EventManager &evm = *FbTk::EventManager::instance(); | 4193 | FbTk::EventManager &evm = *FbTk::EventManager::instance(); |
4203 | 4194 | ||
diff --git a/src/Window.hh b/src/Window.hh index 9991bb6..d04f171 100644 --- a/src/Window.hh +++ b/src/Window.hh | |||
@@ -456,7 +456,6 @@ private: | |||
456 | /// gets title string from client window and updates frame's title | 456 | /// gets title string from client window and updates frame's title |
457 | void updateTitleFromClient(WinClient &client); | 457 | void updateTitleFromClient(WinClient &client); |
458 | /// gets icon name from client window | 458 | /// gets icon name from client window |
459 | void updateIconNameFromClient(WinClient &client); | ||
460 | void updateMWMHintsFromClient(WinClient &client); | 459 | void updateMWMHintsFromClient(WinClient &client); |
461 | void updateBlackboxHintsFromClient(const WinClient &client); | 460 | void updateBlackboxHintsFromClient(const WinClient &client); |
462 | void updateRememberStateFromClient(WinClient &client); | 461 | void updateRememberStateFromClient(WinClient &client); |
@@ -529,7 +528,7 @@ private: | |||
529 | 528 | ||
530 | ClientList m_clientlist; | 529 | ClientList m_clientlist; |
531 | WinClient *m_client; ///< current client | 530 | WinClient *m_client; ///< current client |
532 | typedef std::map<WinClient *, FbTk::TextButton *> Client2ButtonMap; | 531 | typedef std::map<WinClient *, IconButton *> Client2ButtonMap; |
533 | Client2ButtonMap m_labelbuttons; | 532 | Client2ButtonMap m_labelbuttons; |
534 | 533 | ||
535 | // just temporary solution | 534 | // just temporary solution |