aboutsummaryrefslogtreecommitdiff
path: root/src/FbWinFrame.cc
diff options
context:
space:
mode:
authormarkt <markt>2007-11-20 19:01:45 (GMT)
committermarkt <markt>2007-11-20 19:01:45 (GMT)
commit08ebff4b319f51b4263cded0bb9c04103bcd9c3a (patch)
tree559206cfdcb63c85989882fcdaece3b3312e9d4b /src/FbWinFrame.cc
parent2e96a07cf74d66f204ce37daef2c9cc6a7c0b357 (diff)
downloadfluxbox_pavel-08ebff4b319f51b4263cded0bb9c04103bcd9c3a.zip
fluxbox_pavel-08ebff4b319f51b4263cded0bb9c04103bcd9c3a.tar.bz2
move titlebar click handling to FluxboxWindow, fix buttons getting ungrabbed
Diffstat (limited to 'src/FbWinFrame.cc')
-rw-r--r--src/FbWinFrame.cc66
1 files changed, 1 insertions, 65 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index cc7d379..83610ea 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -96,7 +96,6 @@ FbWinFrame::FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageContr
96 m_shaded(false), 96 m_shaded(false),
97 m_focused_alpha(0), 97 m_focused_alpha(0),
98 m_unfocused_alpha(0), 98 m_unfocused_alpha(0),
99 m_double_click_time(0),
100 m_themelistener(*this), 99 m_themelistener(*this),
101 m_shape(m_window, theme.shapePlace()), 100 m_shape(m_window, theme.shapePlace()),
102 m_disable_themeshape(false) { 101 m_disable_themeshape(false) {
@@ -109,23 +108,6 @@ FbWinFrame::~FbWinFrame() {
109 removeAllButtons(); 108 removeAllButtons();
110} 109}
111 110
112bool FbWinFrame::setOnClickTitlebar(FbTk::RefCount<FbTk::Command> &ref, int mousebutton_num,
113 bool double_click, bool pressed) {
114 // find mousebutton_num
115 if (mousebutton_num < 1 || mousebutton_num > 5)
116 return false;
117 if (double_click)
118 m_commands[mousebutton_num - 1].double_click = ref;
119 else {
120 if (pressed)
121 m_commands[mousebutton_num - 1].click_pressed = ref;
122 else
123 m_commands[mousebutton_num - 1].click = ref;
124 }
125
126 return true;
127}
128
129bool FbWinFrame::setTabMode(TabMode tabmode) { 111bool FbWinFrame::setTabMode(TabMode tabmode) {
130 if (m_tabmode == tabmode) 112 if (m_tabmode == tabmode)
131 return false; 113 return false;
@@ -570,10 +552,6 @@ void FbWinFrame::setUseDefaultAlpha(bool default_alpha)
570 } 552 }
571} 553}
572 554
573void FbWinFrame::setDoubleClickTime(unsigned int time) {
574 m_double_click_time = time;
575}
576
577void FbWinFrame::addLeftButton(FbTk::Button *btn) { 555void FbWinFrame::addLeftButton(FbTk::Button *btn) {
578 if (btn == 0) // valid button? 556 if (btn == 0) // valid button?
579 return; 557 return;
@@ -685,7 +663,7 @@ void FbWinFrame::setClientWindow(FbTk::FbWindow &win) {
685 win.reparent(m_window, 0, clientArea().y()); 663 win.reparent(m_window, 0, clientArea().y());
686 // remask window so we get events 664 // remask window so we get events
687 win.setEventMask(PropertyChangeMask | StructureNotifyMask | 665 win.setEventMask(PropertyChangeMask | StructureNotifyMask |
688 FocusChangeMask); 666 FocusChangeMask | KeyPressMask);
689 667
690 m_window.setEventMask(ButtonPressMask | ButtonReleaseMask | 668 m_window.setEventMask(ButtonPressMask | ButtonReleaseMask |
691 ButtonMotionMask | EnterWindowMask | SubstructureRedirectMask); 669 ButtonMotionMask | EnterWindowMask | SubstructureRedirectMask);
@@ -855,47 +833,6 @@ void FbWinFrame::removeEventHandler() {
855 evm.remove(m_clientarea); 833 evm.remove(m_clientarea);
856} 834}
857 835
858void FbWinFrame::buttonPressEvent(XButtonEvent &event) {
859 m_tab_container.tryButtonPressEvent(event);
860 if (event.window == m_grip_right.window() ||
861 event.window == m_grip_left.window() ||
862 event.window == m_clientarea.window() ||
863 event.window == m_window.window())
864 return;
865 // we handle only buttons 0 to 5
866 if (event.button > 5 || event.button < 1)
867 return;
868
869 if (*m_commands[event.button - 1].click_pressed)
870 m_commands[event.button - 1].click_pressed->execute();
871}
872
873void FbWinFrame::buttonReleaseEvent(XButtonEvent &event) {
874 // we continue even if a button got the event
875 m_tab_container.tryButtonReleaseEvent(event);
876
877 if (event.window == m_grip_right.window() ||
878 event.window == m_grip_left.window() ||
879 event.window == m_clientarea.window() ||
880 event.window == m_handle.window() ||
881 event.window == m_window.window())
882 return;
883
884 if (event.button < 1 || event.button > 5)
885 return;
886
887 static Time last_release_time = 0;
888 bool double_click = (event.time - last_release_time <= m_double_click_time);
889 last_release_time = event.time;
890 int real_button = event.button - 1;
891
892 if (double_click && *m_commands[real_button].double_click)
893 m_commands[real_button].double_click->execute();
894 else if (*m_commands[real_button].click)
895 m_commands[real_button].click->execute();
896
897}
898
899void FbWinFrame::exposeEvent(XExposeEvent &event) { 836void FbWinFrame::exposeEvent(XExposeEvent &event) {
900 if (m_titlebar == event.window) { 837 if (m_titlebar == event.window) {
901 m_titlebar.clearArea(event.x, event.y, event.width, event.height); 838 m_titlebar.clearArea(event.x, event.y, event.width, event.height);
@@ -1409,7 +1346,6 @@ void FbWinFrame::init() {
1409 m_button_pm = m_button_unfocused_pm = m_button_pressed_pm = 0; 1346 m_button_pm = m_button_unfocused_pm = m_button_pressed_pm = 0;
1410 m_grip_unfocused_pm = m_grip_focused_pm = 0; 1347 m_grip_unfocused_pm = m_grip_focused_pm = 0;
1411 1348
1412 m_double_click_time = 200;
1413 m_button_size = 26; 1349 m_button_size = 26;
1414 1350
1415 m_clientarea.setBorderWidth(0); 1351 m_clientarea.setBorderWidth(0);