aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-02-22 15:10:43 (GMT)
committerrathnor <rathnor>2003-02-22 15:10:43 (GMT)
commitcc2f023a22db212b4097d7756379bb6b9e866b11 (patch)
tree33cd8f790e760965960d54406250dd73ab0aec93
parent7cf8c0863e6dd07e1023207964605de12f7d0a3c (diff)
downloadfluxbox_pavel-cc2f023a22db212b4097d7756379bb6b9e866b11.zip
fluxbox_pavel-cc2f023a22db212b4097d7756379bb6b9e866b11.tar.bz2
fix focus models for new event handler and Resource setup
-rw-r--r--ChangeLog3
-rw-r--r--src/Screen.cc46
-rw-r--r--src/Screen.hh18
-rw-r--r--src/Window.cc66
-rw-r--r--src/Window.hh4
-rw-r--r--src/fluxbox.cc120
-rw-r--r--src/fluxbox.hh6
7 files changed, 149 insertions, 114 deletions
diff --git a/ChangeLog b/ChangeLog
index 10df0e8..2619fa2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
1(Format: Year/Month/Day) 1(Format: Year/Month/Day)
2Changes for 0.1.15: 2Changes for 0.1.15:
3*03/02/22:
4 * Fixed sloppy focus to use new event handler model (Simon)
5 Screen.hh/cc Window.hh/cc fluxbox.hh/cc
3*03/02/20: 6*03/02/20:
4 * Fixed a size bug without titlebar (Henrik) 7 * Fixed a size bug without titlebar (Henrik)
5 Window.cc, FbWinFrame.cc 8 Window.cc, FbWinFrame.cc
diff --git a/src/Screen.cc b/src/Screen.cc
index ee32f56..9ca7859 100644
--- a/src/Screen.cc
+++ b/src/Screen.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: Screen.cc,v 1.112 2003/02/20 23:31:13 fluxgen Exp $ 25// $Id: Screen.cc,v 1.113 2003/02/22 15:10:43 rathnor Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -139,22 +139,21 @@ FbTk::Menu *createMenuFromScreen(BScreen &screen) {
139 return menu; 139 return menu;
140} 140}
141 141
142/* 142class FocusModelMenuItem : public FbTk::MenuItem {
143class WindowLayerMenuItem : public FbTk::MenuItem {
144public: 143public:
145 WindowLayerMenuItem(const char *label, FluxboxWindow &win, int layernum): 144 FocusModelMenuItem(const char *label, BScreen &screen, Fluxbox::FocusModel model, FbTk::RefCount<FbTk::Command> &cmd):
146 FbTk::MenuItem(label), m_window(win), m_layernum(layernum) { 145 FbTk::MenuItem(label, cmd), m_screen(screen), m_focusmodel(model) {
147 } 146 }
148 bool isEnabled() const { return m_window.getLayerNum() != m_layernum; } 147 bool isEnabled() const { return m_screen.getFocusModel() != m_focusmodel; }
149 void click(int button, int time) { 148 void click(int button, int time) {
150 m_window.moveToLayer(m_layernum); 149 m_screen.saveFocusModel(m_focusmodel);
150 FbTk::MenuItem::click(button, time);
151 } 151 }
152 152
153private: 153private:
154 FluxboxWindow &m_window; 154 BScreen &m_screen;
155 int m_layernum; 155 Fluxbox::FocusModel m_focusmodel;
156}; 156};
157*/
158 157
159 158
160}; // End anonymous namespace 159}; // End anonymous namespace
@@ -363,6 +362,7 @@ BScreen::ScreenResource::ScreenResource(ResourceManager &rm,
363 focus_new(rm, true, scrname+".focusNewWindows", altscrname+".FocusNewWindows"), 362 focus_new(rm, true, scrname+".focusNewWindows", altscrname+".FocusNewWindows"),
364 antialias(rm, false, scrname+".antialias", altscrname+".Antialias"), 363 antialias(rm, false, scrname+".antialias", altscrname+".Antialias"),
365 rootcommand(rm, "", scrname+".rootCommand", altscrname+".RootCommand"), 364 rootcommand(rm, "", scrname+".rootCommand", altscrname+".RootCommand"),
365 focus_model(rm, Fluxbox::CLICKTOFOCUS, scrname+".focusModel", altscrname+".FocusModel"),
366 workspaces(rm, 1, scrname+".workspaces", altscrname+".Workspaces"), 366 workspaces(rm, 1, scrname+".workspaces", altscrname+".Workspaces"),
367 toolbar_width_percent(rm, 65, scrname+".toolbar.widthPercent", altscrname+".Toolbar.WidthPercent"), 367 toolbar_width_percent(rm, 65, scrname+".toolbar.widthPercent", altscrname+".Toolbar.WidthPercent"),
368 edge_snap_threshold(rm, 0, scrname+".edgeSnapThreshold", altscrname+".EdgeSnapThreshold"), 368 edge_snap_threshold(rm, 0, scrname+".edgeSnapThreshold", altscrname+".EdgeSnapThreshold"),
@@ -616,7 +616,7 @@ BScreen::BScreen(ResourceManager &rm,
616 } 616 }
617 } 617 }
618 618
619 if (! resource.sloppy_focus) { 619 if (! isSloppyFocus()) {
620 XSetInputFocus(disp, m_toolbar->getWindowID(), 620 XSetInputFocus(disp, m_toolbar->getWindowID(),
621 RevertToParent, CurrentTime); 621 RevertToParent, CurrentTime);
622 } 622 }
@@ -1733,21 +1733,27 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
1733 // create focus menu 1733 // create focus menu
1734 FbTk::Menu *focus_menu = createMenuFromScreen(*this); 1734 FbTk::Menu *focus_menu = createMenuFromScreen(*this);
1735 1735
1736 /* focus_menu->insert(new BoolMenuItem(i18n->getMessage( 1736 focus_menu->insert(new FocusModelMenuItem(i18n->getMessage(
1737 ConfigmenuSet, ConfigmenuClickToFocus,
1738 "Click To Focus"),*/
1739 focus_menu->insert(new BoolMenuItem(i18n->getMessage(
1740 ConfigmenuSet, 1737 ConfigmenuSet,
1738 ConfigmenuClickToFocus,
1739 "Click To Focus"),
1740 *this,
1741 Fluxbox::CLICKTOFOCUS,
1742 save_and_reconfigure));
1743 focus_menu->insert(new FocusModelMenuItem(i18n->getMessage(
1744 ConfigmenuSet,
1741 ConfigmenuSloppyFocus, 1745 ConfigmenuSloppyFocus,
1742 "Sloppy Focus"), 1746 "Sloppy Focus"),
1743 resource.sloppy_focus, 1747 *this,
1744 save_and_reconfigure)); 1748 Fluxbox::SLOPPYFOCUS,
1745 focus_menu->insert(new BoolMenuItem(i18n->getMessage( 1749 save_and_reconfigure));
1750 focus_menu->insert(new FocusModelMenuItem(i18n->getMessage(
1746 ConfigmenuSet, 1751 ConfigmenuSet,
1747 ConfigmenuSemiSloppyFocus, 1752 ConfigmenuSemiSloppyFocus,
1748 "Semi Sloppy Focus"), 1753 "Semi Sloppy Focus"),
1749 resource.semi_sloppy_focus, 1754 *this,
1750 save_and_reconfigure)); 1755 Fluxbox::SEMISLOPPYFOCUS,
1756 save_and_reconfigure));
1751 focus_menu->insert(new BoolMenuItem(i18n->getMessage( 1757 focus_menu->insert(new BoolMenuItem(i18n->getMessage(
1752 ConfigmenuSet, 1758 ConfigmenuSet,
1753 ConfigmenuAutoRaise, 1759 ConfigmenuAutoRaise,
diff --git a/src/Screen.hh b/src/Screen.hh
index 1b833d4..a30ca40 100644
--- a/src/Screen.hh
+++ b/src/Screen.hh
@@ -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: Screen.hh,v 1.69 2003/02/20 23:33:08 fluxgen Exp $ 25// $Id: Screen.hh,v 1.70 2003/02/22 15:10:43 rathnor Exp $
26 26
27#ifndef SCREEN_HH 27#ifndef SCREEN_HH
28#define SCREEN_HH 28#define SCREEN_HH
@@ -79,8 +79,8 @@ public:
79 ~BScreen(); 79 ~BScreen();
80 80
81 inline bool doToolbarAutoHide() const { return *resource.toolbar_auto_hide; } 81 inline bool doToolbarAutoHide() const { return *resource.toolbar_auto_hide; }
82 inline bool isSloppyFocus() const { return resource.sloppy_focus; } 82 inline bool isSloppyFocus() const { return (*resource.focus_model == Fluxbox::SLOPPYFOCUS); }
83 inline bool isSemiSloppyFocus() const { return resource.semi_sloppy_focus; } 83 inline bool isSemiSloppyFocus() const { return (*resource.focus_model == Fluxbox::SEMISLOPPYFOCUS); }
84 inline bool isRootColormapInstalled() const { return root_colormap_installed; } 84 inline bool isRootColormapInstalled() const { return root_colormap_installed; }
85 inline bool isScreenManaged() const { return managed; } 85 inline bool isScreenManaged() const { return managed; }
86 inline bool isTabRotateVertical() const { return *resource.tab_rotate_vertical; } 86 inline bool isTabRotateVertical() const { return *resource.tab_rotate_vertical; }
@@ -104,6 +104,7 @@ public:
104 FbTk::Menu * const getRootmenu() { return m_rootmenu.get(); } 104 FbTk::Menu * const getRootmenu() { return m_rootmenu.get(); }
105 105
106 inline const std::string &getRootCommand() const { return *resource.rootcommand; } 106 inline const std::string &getRootCommand() const { return *resource.rootcommand; }
107 inline Fluxbox::FocusModel getFocusModel() const { return *resource.focus_model; }
107 108
108 inline bool doSlitAutoHide() const { return resource.slit_auto_hide; } 109 inline bool doSlitAutoHide() const { return resource.slit_auto_hide; }
109#ifdef SLIT 110#ifdef SLIT
@@ -188,9 +189,10 @@ public:
188 189
189 inline void setRootColormapInstalled(Bool r) { root_colormap_installed = r; } 190 inline void setRootColormapInstalled(Bool r) { root_colormap_installed = r; }
190 inline void saveRootCommand(std::string rootcmd) { *resource.rootcommand = rootcmd; } 191 inline void saveRootCommand(std::string rootcmd) { *resource.rootcommand = rootcmd; }
191 inline void saveSloppyFocus(bool s) { resource.sloppy_focus = s; } 192 inline void saveFocusModel(Fluxbox::FocusModel model) { resource.focus_model = model; }
192 inline void saveSemiSloppyFocus(bool s) { resource.semi_sloppy_focus = s; } 193 //DEL inline void saveSloppyFocus(bool s) { resource.sloppy_focus = s; }
193 inline void saveAutoRaise(bool a) { resource.auto_raise = a; } 194 //DEL inline void saveSemiSloppyFocus(bool s) { resource.semi_sloppy_focus = s; }
195 //DEL inline void saveAutoRaise(bool a) { resource.auto_raise = a; }
194 inline void saveWorkspaces(int w) { *resource.workspaces = w; } 196 inline void saveWorkspaces(int w) { *resource.workspaces = w; }
195 inline void saveToolbarAutoHide(bool r) { *resource.toolbar_auto_hide = r; } 197 inline void saveToolbarAutoHide(bool r) { *resource.toolbar_auto_hide = r; }
196 inline void saveToolbarWidthPercent(int w) { *resource.toolbar_width_percent = w; } 198 inline void saveToolbarWidthPercent(int w) { *resource.toolbar_width_percent = w; }
@@ -382,8 +384,8 @@ private:
382 focus_last, focus_new, 384 focus_last, focus_new,
383 antialias; 385 antialias;
384 Resource<std::string> rootcommand; 386 Resource<std::string> rootcommand;
385 bool auto_raise, sloppy_focus, semi_sloppy_focus, 387 Resource<Fluxbox::FocusModel> focus_model;
386 ordered_dither; 388 bool auto_raise, ordered_dither;
387 Resource<int> workspaces, toolbar_width_percent, edge_snap_threshold, 389 Resource<int> workspaces, toolbar_width_percent, edge_snap_threshold,
388 tab_width, tab_height; 390 tab_width, tab_height;
389 Resource<Fluxbox::Layer> slit_layernum, toolbar_layernum; 391 Resource<Fluxbox::Layer> slit_layernum, toolbar_layernum;
diff --git a/src/Window.cc b/src/Window.cc
index 73afefc..ec0d7f3 100644
--- a/src/Window.cc
+++ b/src/Window.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: Window.cc,v 1.122 2003/02/20 23:17:36 fluxgen Exp $ 25// $Id: Window.cc,v 1.123 2003/02/22 15:10:43 rathnor Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -93,6 +93,26 @@ void grabButton(Display *display, unsigned int button,
93 93
94} 94}
95 95
96// X event scanner for enter/leave notifies - adapted from twm
97typedef struct scanargs {
98 Window w;
99 Bool leave, inferior, enter;
100} scanargs;
101
102// look for valid enter or leave events (that may invalidate the earlier one we are interested in)
103static Bool queueScanner(Display *, XEvent *e, char *args) {
104 if ((e->type == LeaveNotify) &&
105 (e->xcrossing.window == ((scanargs *) args)->w) &&
106 (e->xcrossing.mode == NotifyNormal)) {
107 ((scanargs *) args)->leave = True;
108 ((scanargs *) args)->inferior = (e->xcrossing.detail == NotifyInferior);
109 } else if ((e->type == EnterNotify) &&
110 (e->xcrossing.mode == NotifyUngrab))
111 ((scanargs *) args)->enter = True;
112
113 return False;
114}
115
96/// raise window and do the same for each transient it holds 116/// raise window and do the same for each transient it holds
97void raiseFluxboxWindow(FluxboxWindow &win) { 117void raiseFluxboxWindow(FluxboxWindow &win) {
98 118
@@ -2066,12 +2086,12 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2066 m_frame.x() < int(me.x_root - button_grab_x - screen->getBorderWidth())) { 2086 m_frame.x() < int(me.x_root - button_grab_x - screen->getBorderWidth())) {
2067 //warp right 2087 //warp right
2068 new_id = (cur_id + 1) % screen->getCount(); 2088 new_id = (cur_id + 1) % screen->getCount();
2069 dx = - me.x_root; 2089 dx = - me.x_root; // move mouse back to x=0
2070 } else if (me.x_root <= warpPad && 2090 } else if (me.x_root <= warpPad &&
2071 m_frame.x() > int(me.x_root - button_grab_x - screen->getBorderWidth())) { 2091 m_frame.x() > int(me.x_root - button_grab_x - screen->getBorderWidth())) {
2072 //warp left 2092 //warp left
2073 new_id = (cur_id - 1 + screen->getCount()) % screen->getCount(); 2093 new_id = (cur_id - 1 + screen->getCount()) % screen->getCount();
2074 dx = screen->getWidth() - me.x_root-1; 2094 dx = screen->getWidth() - me.x_root-1; // move mouse to screen width - 1
2075 } 2095 }
2076 2096
2077 if (new_id != cur_id) { 2097 if (new_id != cur_id) {
@@ -2081,8 +2101,8 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2081 2101
2082 last_resize_x = me.x_root + dx; 2102 last_resize_x = me.x_root + dx;
2083 2103
2084 dx += m_frame.x(); // for window in correct position 2104 // change dx to be relative to window rather than motion event
2085 2105 dx += m_frame.x();
2086 } 2106 }
2087 } 2107 }
2088 2108
@@ -2098,7 +2118,6 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2098 last_move_x = dx; 2118 last_move_x = dx;
2099 last_move_y = dy; 2119 last_move_y = dy;
2100 } else { 2120 } else {
2101
2102 moveResize(dx, dy, m_frame.width(), m_frame.height()); 2121 moveResize(dx, dy, m_frame.width(), m_frame.height());
2103 } 2122 }
2104 2123
@@ -2154,6 +2173,41 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2154 2173
2155} 2174}
2156 2175
2176void FluxboxWindow::enterNotifyEvent(XCrossingEvent &ev) {
2177
2178 // ignore grab activates, or if we're not visible
2179 if (ev.mode == NotifyGrab ||
2180 !isVisible()) {
2181 return;
2182 }
2183
2184 if (ev.window == getFrameWindow() ||
2185 (!getFrameWindow() && ev.window == client.window)) {
2186 if ((screen->isSloppyFocus() || screen->isSemiSloppyFocus())
2187 && !isFocused()) {
2188 Fluxbox::instance()->grab();
2189
2190 // check that there aren't any subsequent leave notify events in the
2191 // X event queue
2192 XEvent dummy;
2193 scanargs sa;
2194 sa.w = ev.window;
2195 sa.enter = sa.leave = False;
2196 XCheckIfEvent(display, &dummy, queueScanner, (char *) &sa);
2197
2198 if ((!sa.leave || sa.inferior) && setInputFocus())
2199 installColormap(True);
2200
2201 Fluxbox::instance()->ungrab();
2202 }
2203 }
2204}
2205
2206void FluxboxWindow::leaveNotifyEvent(XCrossingEvent &ev) {
2207 if (ev.window == getFrameWindow())
2208 installColormap(False);
2209}
2210
2157// TODO: functions should not be affected by decoration 2211// TODO: functions should not be affected by decoration
2158void FluxboxWindow::setDecoration(Decoration decoration) { 2212void FluxboxWindow::setDecoration(Decoration decoration) {
2159 switch (decoration) { 2213 switch (decoration) {
diff --git a/src/Window.hh b/src/Window.hh
index f55b307..5535c6e 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -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: Window.hh,v 1.50 2003/02/18 15:11:11 rathnor Exp $ 25// $Id: Window.hh,v 1.51 2003/02/22 15:10:43 rathnor Exp $
26 26
27#ifndef WINDOW_HH 27#ifndef WINDOW_HH
28#define WINDOW_HH 28#define WINDOW_HH
@@ -173,6 +173,8 @@ public:
173 void exposeEvent(XExposeEvent &ee); 173 void exposeEvent(XExposeEvent &ee);
174 void configureRequestEvent(XConfigureRequestEvent &ce); 174 void configureRequestEvent(XConfigureRequestEvent &ce);
175 void propertyNotifyEvent(Atom a); 175 void propertyNotifyEvent(Atom a);
176 void enterNotifyEvent(XCrossingEvent &ev);
177 void leaveNotifyEvent(XCrossingEvent &ev);
176 //@} 178 //@}
177 179
178 void setDecoration(Decoration decoration); 180 void setDecoration(Decoration decoration);
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index be41df1..1cb66a9 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.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: fluxbox.cc,v 1.97 2003/02/18 15:11:12 rathnor Exp $ 25// $Id: fluxbox.cc,v 1.98 2003/02/22 15:10:43 rathnor Exp $
26 26
27 27
28#include "fluxbox.hh" 28#include "fluxbox.hh"
@@ -143,25 +143,6 @@ char *basename (char *s) {
143#define RC_PATH "fluxbox" 143#define RC_PATH "fluxbox"
144#define RC_INIT_FILE "init" 144#define RC_INIT_FILE "init"
145 145
146
147// X event scanner for enter/leave notifies - adapted from twm
148typedef struct scanargs {
149 Window w;
150 Bool leave, inferior, enter;
151} scanargs;
152
153static Bool queueScanner(Display *, XEvent *e, char *args) {
154 if ((e->type == LeaveNotify) &&
155 (e->xcrossing.window == ((scanargs *) args)->w) &&
156 (e->xcrossing.mode == NotifyNormal)) {
157 ((scanargs *) args)->leave = True;
158 ((scanargs *) args)->inferior = (e->xcrossing.detail == NotifyInferior);
159 } else if ((e->type == EnterNotify) &&
160 (e->xcrossing.mode == NotifyUngrab))
161 ((scanargs *) args)->enter = True;
162
163 return False;
164}
165//----------------------------------------------------------------- 146//-----------------------------------------------------------------
166//---- accessors for int, bool, and some enums with Resource ------ 147//---- accessors for int, bool, and some enums with Resource ------
167//----------------------------------------------------------------- 148//-----------------------------------------------------------------
@@ -189,6 +170,19 @@ setFromString(char const *strval) {
189} 170}
190 171
191template<> 172template<>
173void Resource<Fluxbox::FocusModel>::
174setFromString(char const *strval) {
175 if (strcasecmp(strval, "SloppyFocus") == 0)
176 m_value = Fluxbox::SLOPPYFOCUS;
177 else if (strcasecmp(strval, "SemiSloppyFocus") == 0)
178 m_value = Fluxbox::SEMISLOPPYFOCUS;
179 else if (strcasecmp(strval, "ClickToFocus") == 0)
180 m_value = Fluxbox::CLICKTOFOCUS;
181 else
182 setDefaultValue();
183}
184
185template<>
192void Resource<Fluxbox::TitlebarList>:: 186void Resource<Fluxbox::TitlebarList>::
193setFromString(char const *strval) { 187setFromString(char const *strval) {
194 vector<std::string> val; 188 vector<std::string> val;
@@ -242,6 +236,21 @@ std::string Resource<std::string>::
242getString() { return **this; } 236getString() { return **this; }
243 237
244template<> 238template<>
239std::string Resource<Fluxbox::FocusModel>::
240getString() {
241 switch (m_value) {
242 case Fluxbox::SLOPPYFOCUS:
243 return string("SloppyFocus");
244 case Fluxbox::SEMISLOPPYFOCUS:
245 return string("SemiSloppyFocus");
246 case Fluxbox::CLICKTOFOCUS:
247 return string("ClickToFocus");
248 }
249 // default string
250 return string("ClickToFocus");
251}
252
253template<>
245std::string Resource<Fluxbox::TitlebarList>:: 254std::string Resource<Fluxbox::TitlebarList>::
246getString() { 255getString() {
247 string retval; 256 string retval;
@@ -691,18 +700,7 @@ void Fluxbox::handleEvent(XEvent * const e) {
691 700
692 } 701 }
693 break; 702 break;
694 case MotionNotify: { 703 case MotionNotify:
695 last_time = e->xmotion.time;
696
697 FluxboxWindow *win = 0;
698 Tab *tab = 0;
699
700 if ((win = searchWindow(e->xmotion.window)) !=0)
701 win->motionNotifyEvent(e->xmotion);
702 else if ((tab = searchTab(e->xmotion.window)) !=0)
703 tab->motionNotifyEvent(&e->xmotion);
704
705 }
706 break; 704 break;
707 case PropertyNotify: { 705 case PropertyNotify: {
708 706
@@ -719,63 +717,26 @@ void Fluxbox::handleEvent(XEvent * const e) {
719 break; 717 break;
720 case EnterNotify: { 718 case EnterNotify: {
721 last_time = e->xcrossing.time; 719 last_time = e->xcrossing.time;
722
723 BScreen *screen = 0; 720 BScreen *screen = 0;
724 FluxboxWindow *win = 0;
725 Tab *tab = 0;
726 721
727 if (e->xcrossing.mode == NotifyGrab) 722 if (e->xcrossing.mode == NotifyGrab)
728 break; 723 break;
729 724
730 XEvent dummy;
731 scanargs sa;
732 sa.w = e->xcrossing.window;
733 sa.enter = sa.leave = False;
734 XCheckIfEvent(getXDisplay(), &dummy, queueScanner, (char *) &sa);
735
736 if ((e->xcrossing.window == e->xcrossing.root) && 725 if ((e->xcrossing.window == e->xcrossing.root) &&
737 (screen = searchScreen(e->xcrossing.window))) { 726 (screen = searchScreen(e->xcrossing.window))) {
738 screen->getImageControl()->installRootColormap(); 727 screen->getImageControl()->installRootColormap();
739 } else if ((win = searchWindow(e->xcrossing.window))) {
740 if ((win->getScreen()->isSloppyFocus() ||
741 win->getScreen()->isSemiSloppyFocus()) &&
742 (! win->isFocused()) && (! no_focus)) {
743
744 grab();
745
746 if (((! sa.leave) || sa.inferior) && win->isVisible() &&
747 win->setInputFocus())
748 win->installColormap(True);
749 728
750 ungrab(); 729 // if sloppy focus, then remove focus from windows
751 } 730 if (screen->isSloppyFocus() ||
752 } else if ((tab = searchTab(e->xcrossing.window))) { 731 screen->isSemiSloppyFocus())
753 win = tab->getWindow(); 732 setFocusedWindow(0);
754 if (win->getScreen()->isSloppyFocus() && (! win->isFocused()) && 733 }
755 (! no_focus)) {
756 win->raise();
757
758 grab();
759
760 if (((! sa.leave) || sa.inferior) && win->isVisible() &&
761 win->setInputFocus())
762 win->installColormap(True);
763
764 ungrab();
765 }
766 }
767 734
768 } 735 }
769 break; 736 break;
770 case LeaveNotify: 737 case LeaveNotify:
771 { 738 {
772 last_time = e->xcrossing.time; 739 last_time = e->xcrossing.time;
773
774 FluxboxWindow *win = (FluxboxWindow *) 0;
775
776 if ((win = searchWindow(e->xcrossing.window)))
777 win->installColormap(false);
778
779 } 740 }
780 break; 741 break;
781 case Expose: 742 case Expose:
@@ -841,6 +802,7 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) {
841 FluxboxWindow *win = 0; 802 FluxboxWindow *win = 0;
842 Tab *tab = 0; 803 Tab *tab = 0;
843 804
805 /*
844 if ((win = searchWindow(be.window))) { 806 if ((win = searchWindow(be.window))) {
845 807
846 win->buttonPressEvent(be); 808 win->buttonPressEvent(be);
@@ -848,7 +810,7 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) {
848 if (be.button == 1) 810 if (be.button == 1)
849 win->installColormap(True); 811 win->installColormap(True);
850 } 812 }
851 else if ((tab = searchTab(be.window))) { 813 else*/ if ((tab = searchTab(be.window))) {
852 tab->buttonPressEvent(&be); 814 tab->buttonPressEvent(&be);
853 } else { 815 } else {
854 ScreenList::iterator it = screenList.begin(); 816 ScreenList::iterator it = screenList.begin();
@@ -1782,6 +1744,8 @@ void Fluxbox::save_rc() {
1782 placement.c_str()); 1744 placement.c_str());
1783 XrmPutLineResource(&new_blackboxrc, rc_string); 1745 XrmPutLineResource(&new_blackboxrc, rc_string);
1784 1746
1747 //TODO
1748/*
1785 std::string focus_mode; 1749 std::string focus_mode;
1786 if (screen->isSloppyFocus() && screen->doAutoRaise()) 1750 if (screen->isSloppyFocus() && screen->doAutoRaise())
1787 focus_mode = "AutoRaiseSloppyFocus"; 1751 focus_mode = "AutoRaiseSloppyFocus";
@@ -1797,7 +1761,7 @@ void Fluxbox::save_rc() {
1797 sprintf(rc_string, "session.screen%d.focusModel: %s", screen_number, 1761 sprintf(rc_string, "session.screen%d.focusModel: %s", screen_number,
1798 focus_mode.c_str()); 1762 focus_mode.c_str());
1799 XrmPutLineResource(&new_blackboxrc, rc_string); 1763 XrmPutLineResource(&new_blackboxrc, rc_string);
1800 1764*/
1801 // load_rc(screen); 1765 // load_rc(screen);
1802 // these are static, but may not be saved in the users resource file, 1766 // these are static, but may not be saved in the users resource file,
1803 // writing these resources will allow the user to edit them at a later 1767 // writing these resources will allow the user to edit them at a later
@@ -2024,6 +1988,8 @@ void Fluxbox::load_rc(BScreen *screen) {
2024 delete [] search; 1988 delete [] search;
2025 } 1989 }
2026 1990
1991//TODO (use Fluxbox::FocusModel enum)
1992 /*
2027 sprintf(name_lookup, "session.screen%d.focusModel", screen_number); 1993 sprintf(name_lookup, "session.screen%d.focusModel", screen_number);
2028 sprintf(class_lookup, "Session.Screen%d.FocusModel", screen_number); 1994 sprintf(class_lookup, "Session.Screen%d.FocusModel", screen_number);
2029 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type, 1995 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
@@ -2058,7 +2024,7 @@ void Fluxbox::load_rc(BScreen *screen) {
2058 screen->saveSloppyFocus(true); 2024 screen->saveSloppyFocus(true);
2059 screen->saveAutoRaise(false); 2025 screen->saveAutoRaise(false);
2060 } 2026 }
2061 2027 */
2062 sprintf(name_lookup, "session.screen%d.windowPlacement", screen_number); 2028 sprintf(name_lookup, "session.screen%d.windowPlacement", screen_number);
2063 sprintf(class_lookup, "Session.Screen%d.WindowPlacement", screen_number); 2029 sprintf(class_lookup, "Session.Screen%d.WindowPlacement", screen_number);
2064 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type, 2030 if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
diff --git a/src/fluxbox.hh b/src/fluxbox.hh
index 84aac80..cce734f 100644
--- a/src/fluxbox.hh
+++ b/src/fluxbox.hh
@@ -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: fluxbox.hh,v 1.43 2003/02/18 15:11:12 rathnor Exp $ 25// $Id: fluxbox.hh,v 1.44 2003/02/22 15:10:43 rathnor Exp $
26 26
27#ifndef FLUXBOX_HH 27#ifndef FLUXBOX_HH
28#define FLUXBOX_HH 28#define FLUXBOX_HH
@@ -103,7 +103,9 @@ public:
103 103
104 /// obsolete 104 /// obsolete
105 enum Titlebar{SHADE=0, MINIMIZE, MAXIMIZE, CLOSE, STICK, MENU, EMPTY}; 105 enum Titlebar{SHADE=0, MINIMIZE, MAXIMIZE, CLOSE, STICK, MENU, EMPTY};
106 106
107 enum FocusModel { SLOPPYFOCUS=0, SEMISLOPPYFOCUS, CLICKTOFOCUS };
108
107 inline const std::vector<Fluxbox::Titlebar>& getTitlebarRight() { return *m_rc_titlebar_right; } 109 inline const std::vector<Fluxbox::Titlebar>& getTitlebarRight() { return *m_rc_titlebar_right; }
108 inline const std::vector<Fluxbox::Titlebar>& getTitlebarLeft() { return *m_rc_titlebar_left; } 110 inline const std::vector<Fluxbox::Titlebar>& getTitlebarLeft() { return *m_rc_titlebar_left; }
109 inline const std::string &getStyleFilename() const { return *m_rc_stylefile; } 111 inline const std::string &getStyleFilename() const { return *m_rc_stylefile; }