aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormarkt <markt>2007-11-22 20:21:47 (GMT)
committermarkt <markt>2007-11-22 20:21:47 (GMT)
commitbb6906fa80c06fc23975d7520b3e8919423a29b4 (patch)
tree214427a1221e350ce62e08e0656678d260ccf10f /src
parent58cd017db04b83d0cb3b24882d1ba7471ec4d6e1 (diff)
downloadfluxbox_pavel-bb6906fa80c06fc23975d7520b3e8919423a29b4.zip
fluxbox_pavel-bb6906fa80c06fc23975d7520b3e8919423a29b4.tar.bz2
added special FocusIn/Out MouseOver/Out ChangeWorkspace keys
Diffstat (limited to 'src')
-rw-r--r--src/FbCommandFactory.cc7
-rw-r--r--src/FbTk/LogicCommands.hh8
-rw-r--r--src/FbWinFrame.cc6
-rw-r--r--src/Keys.cc33
-rw-r--r--src/Screen.cc2
-rw-r--r--src/Toolbar.cc11
-rw-r--r--src/Window.cc26
7 files changed, 76 insertions, 17 deletions
diff --git a/src/FbCommandFactory.cc b/src/FbCommandFactory.cc
index 92099f2..8f5dcf8 100644
--- a/src/FbCommandFactory.cc
+++ b/src/FbCommandFactory.cc
@@ -809,17 +809,16 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
809 pos = err; 809 pos = err;
810 err = FbTk::StringUtil::getStringBetween(cmd, arguments.c_str() + pos, 810 err = FbTk::StringUtil::getStringBetween(cmd, arguments.c_str() + pos,
811 '{', '}', " \t\n", true); 811 '{', '}', " \t\n", true);
812 if (err > 0) 812 if (err == 0)
813 t = CommandParser::instance().parseLine(cmd, trusted);
814 if (err == 0 || *t == 0)
815 return 0; 813 return 0;
814 t = CommandParser::instance().parseLine(cmd, trusted);
816 815
817 pos += err; 816 pos += err;
818 err = FbTk::StringUtil::getStringBetween(cmd, arguments.c_str() + pos, 817 err = FbTk::StringUtil::getStringBetween(cmd, arguments.c_str() + pos,
819 '{', '}', " \t\n", true); 818 '{', '}', " \t\n", true);
820 if (err > 0) 819 if (err > 0)
821 f = CommandParser::instance().parseLine(cmd, trusted); 820 f = CommandParser::instance().parseLine(cmd, trusted);
822 if (err == 0 || *f == 0) 821 if (err == 0 || *t == 0 && *f == 0)
823 return 0; 822 return 0;
824 823
825 return new FbTk::IfCommand(cond, t, f); 824 return new FbTk::IfCommand(cond, t, f);
diff --git a/src/FbTk/LogicCommands.hh b/src/FbTk/LogicCommands.hh
index a94dad8..4f20864 100644
--- a/src/FbTk/LogicCommands.hh
+++ b/src/FbTk/LogicCommands.hh
@@ -38,10 +38,10 @@ public:
38 RefCount<Command> &t, RefCount<Command> &f): 38 RefCount<Command> &t, RefCount<Command> &f):
39 m_cond(cond), m_t(t), m_f(f) { } 39 m_cond(cond), m_t(t), m_f(f) { }
40 void execute() { 40 void execute() {
41 if (m_cond->bool_execute()) 41 if (m_cond->bool_execute()) {
42 m_t->execute(); 42 if (*m_t) m_t->execute();
43 else 43 } else
44 m_f->execute(); 44 if (*m_f) m_f->execute();
45 } 45 }
46 46
47private: 47private:
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index 83610ea..f710416 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -55,7 +55,8 @@ FbWinFrame::FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageContr
55 m_imagectrl(imgctrl), 55 m_imagectrl(imgctrl),
56 m_window(theme.screenNum(), x, y, width, height, 56 m_window(theme.screenNum(), x, y, width, height,
57 ButtonPressMask | ButtonReleaseMask | 57 ButtonPressMask | ButtonReleaseMask |
58 ButtonMotionMask | EnterWindowMask, true), 58 ButtonMotionMask | EnterWindowMask |
59 LeaveWindowMask, true),
59 m_layeritem(window(), layer), 60 m_layeritem(window(), layer),
60 m_titlebar(m_window, 0, 0, 100, 16, 61 m_titlebar(m_window, 0, 0, 100, 16,
61 ButtonPressMask | ButtonReleaseMask | 62 ButtonPressMask | ButtonReleaseMask |
@@ -666,7 +667,8 @@ void FbWinFrame::setClientWindow(FbTk::FbWindow &win) {
666 FocusChangeMask | KeyPressMask); 667 FocusChangeMask | KeyPressMask);
667 668
668 m_window.setEventMask(ButtonPressMask | ButtonReleaseMask | 669 m_window.setEventMask(ButtonPressMask | ButtonReleaseMask |
669 ButtonMotionMask | EnterWindowMask | SubstructureRedirectMask); 670 ButtonMotionMask | EnterWindowMask |
671 LeaveWindowMask | SubstructureRedirectMask);
670 672
671 XFlush(win.display()); 673 XFlush(win.display());
672 674
diff --git a/src/Keys.cc b/src/Keys.cc
index 2d26ab8..f3cd092 100644
--- a/src/Keys.cc
+++ b/src/Keys.cc
@@ -307,10 +307,35 @@ bool Keys::addBinding(const string &linebuffer) {
307 context |= ON_WINDOW; 307 context |= ON_WINDOW;
308 else if (strcasecmp("NONE",val[argc].c_str())) { 308 else if (strcasecmp("NONE",val[argc].c_str())) {
309 // check if it's a mouse button 309 // check if it's a mouse button
310 if (!strcasecmp(val[argc].substr(0,5).c_str(), "mouse") && 310 if (strcasecmp("focusin", val[argc].c_str()) == 0) {
311 val[argc].length() > 5) { 311 context = ON_WINDOW;
312 mod = key = 0;
313 type = FocusIn;
314 } else if (strcasecmp("focusout", val[argc].c_str()) == 0) {
315 context = ON_WINDOW;
316 mod = key = 0;
317 type = FocusOut;
318 } else if (strcasecmp("changeworkspace",
319 val[argc].c_str()) == 0) {
320 context = ON_DESKTOP;
321 mod = key = 0;
322 type = FocusIn;
323 } else if (strcasecmp("mouseover", val[argc].c_str()) == 0) {
324 type = EnterNotify;
325 if (!(context & (ON_WINDOW|ON_TOOLBAR)))
326 context |= ON_WINDOW;
327 key = 0;
328 } else if (strcasecmp("mouseout", val[argc].c_str()) == 0) {
329 type = LeaveNotify;
330 if (!(context & (ON_WINDOW|ON_TOOLBAR)))
331 context |= ON_WINDOW;
332 key = 0;
333 } else if (strcasecmp(val[argc].substr(0,5).c_str(),
334 "mouse") == 0 &&
335 val[argc].length() > 5) {
312 type = ButtonPress; 336 type = ButtonPress;
313 key = atoi(val[argc].substr(5,val[argc].length()-5).c_str()); 337 key = atoi(val[argc].substr(5,
338 val[argc].length()-5).c_str());
314 // keycode covers the following three two-byte cases: 339 // keycode covers the following three two-byte cases:
315 // 0x - hex 340 // 0x - hex
316 // +[1-9] - number between +1 and +9 341 // +[1-9] - number between +1 and +9
@@ -331,7 +356,7 @@ bool Keys::addBinding(const string &linebuffer) {
331 type = KeyPress; 356 type = KeyPress;
332 } 357 }
333 358
334 if (key == 0) 359 if (key == 0 && (type == KeyPress || type == ButtonPress))
335 return false; 360 return false;
336 if (!first_new_key) { 361 if (!first_new_key) {
337 first_new_keylist = current_key; 362 first_new_keylist = current_key;
diff --git a/src/Screen.cc b/src/Screen.cc
index 0c26a70..155a113 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -1237,6 +1237,8 @@ void BScreen::changeWorkspaceID(unsigned int id, bool revert) {
1237 1237
1238 m_currentworkspace_sig.notify(); 1238 m_currentworkspace_sig.notify();
1239 1239
1240 // do this after atom handlers, so scripts can access new workspace number
1241 Fluxbox::instance()->keys()->doAction(FocusIn, 0, 0, Keys::ON_DESKTOP);
1240} 1242}
1241 1243
1242 1244
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index 32925de..2694a4c 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.cc
@@ -556,7 +556,9 @@ void Toolbar::buttonPressEvent(XButtonEvent &be) {
556 556
557} 557}
558 558
559void Toolbar::enterNotifyEvent(XCrossingEvent &not_used) { 559void Toolbar::enterNotifyEvent(XCrossingEvent &ce) {
560 Fluxbox::instance()->keys()->doAction(ce.type, ce.state, 0,
561 Keys::ON_TOOLBAR);
560 if (! doAutoHide()) { 562 if (! doAutoHide()) {
561 if (isHidden()) 563 if (isHidden())
562 toggleHidden(); 564 toggleHidden();
@@ -573,13 +575,16 @@ void Toolbar::enterNotifyEvent(XCrossingEvent &not_used) {
573} 575}
574 576
575void Toolbar::leaveNotifyEvent(XCrossingEvent &event) { 577void Toolbar::leaveNotifyEvent(XCrossingEvent &event) {
576 if (! doAutoHide())
577 return;
578 // still inside? 578 // still inside?
579 if (event.x_root > x() && event.x_root <= (int)(x() + width()) && 579 if (event.x_root > x() && event.x_root <= (int)(x() + width()) &&
580 event.y_root > y() && event.y_root <= (int)(y() + height())) 580 event.y_root > y() && event.y_root <= (int)(y() + height()))
581 return; 581 return;
582 582
583 Fluxbox::instance()->keys()->doAction(event.type, event.state, 0,
584 Keys::ON_TOOLBAR);
585 if (! doAutoHide())
586 return;
587
583 if (isHidden()) { 588 if (isHidden()) {
584 if (m_hide_timer.isTiming()) 589 if (m_hide_timer.isTiming())
585 m_hide_timer.stop(); 590 m_hide_timer.stop();
diff --git a/src/Window.cc b/src/Window.cc
index 0fb8673..0db3b80 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -1930,6 +1930,9 @@ void FluxboxWindow::setFocusFlag(bool focus) {
1930 m_focussig.notify(); 1930 m_focussig.notify();
1931 if (m_client) 1931 if (m_client)
1932 m_client->focusSig().notify(); 1932 m_client->focusSig().notify();
1933 WindowCmd<void>::setClient(m_client);
1934 Fluxbox::instance()->keys()->doAction(focus ? FocusIn : FocusOut, 0, 0,
1935 Keys::ON_WINDOW);
1933 } 1936 }
1934} 1937}
1935 1938
@@ -2942,6 +2945,12 @@ void FluxboxWindow::enterNotifyEvent(XCrossingEvent &ev) {
2942 return; 2945 return;
2943 } 2946 }
2944 2947
2948 if (ev.window == frame().window()) {
2949 WindowCmd<void>::setWindow(this);
2950 Fluxbox::instance()->keys()->doAction(ev.type, ev.state, 0,
2951 Keys::ON_WINDOW);
2952 }
2953
2945 WinClient *client = 0; 2954 WinClient *client = 0;
2946 if (screen().focusControl().isMouseTabFocus()) { 2955 if (screen().focusControl().isMouseTabFocus()) {
2947 // determine if we're in a label button (tab) 2956 // determine if we're in a label button (tab)
@@ -2984,6 +2993,23 @@ void FluxboxWindow::enterNotifyEvent(XCrossingEvent &ev) {
2984} 2993}
2985 2994
2986void FluxboxWindow::leaveNotifyEvent(XCrossingEvent &ev) { 2995void FluxboxWindow::leaveNotifyEvent(XCrossingEvent &ev) {
2996
2997 // ignore grab activates, or if we're not visible
2998 if (ev.mode == NotifyGrab || ev.mode == NotifyUngrab ||
2999 !isVisible()) {
3000 return;
3001 }
3002
3003 // still inside?
3004 if (ev.x_root > frame().x() && ev.y_root > frame().y() &&
3005 ev.x_root <= (int)(frame().x() + frame().width()) &&
3006 ev.y_root <= (int)(frame().y() + frame().height()))
3007 return;
3008
3009 WindowCmd<void>::setWindow(this);
3010 Fluxbox::instance()->keys()->doAction(ev.type, ev.state, 0,
3011 Keys::ON_WINDOW);
3012
2987 // I hope commenting this out is right - simon 21jul2003 3013 // I hope commenting this out is right - simon 21jul2003
2988 //if (ev.window == frame().window()) 3014 //if (ev.window == frame().window())
2989 //installColormap(false); 3015 //installColormap(false);