209
void FbTk::Resource<FbWinFrame::TabPlacement>::
210
setFromString(const char *strval) {
211
if (strcasecmp(strval, "TopLeft") == 0)
212
m_value = FbWinFrame::TOPLEFT;
213
else if (strcasecmp(strval, "BottomLeft") == 0)
214
m_value = FbWinFrame::BOTTOMLEFT;
215
else if (strcasecmp(strval, "Top") == 0)
216
m_value = FbWinFrame::TOP;
217
else if (strcasecmp(strval, "Bottom") == 0)
218
m_value = FbWinFrame::BOTTOM;
219
else if (strcasecmp(strval, "TopRight") == 0)
220
m_value = FbWinFrame::TOPRIGHT;
221
else if (strcasecmp(strval, "BottomRight") == 0)
222
m_value = FbWinFrame::BOTTOMRIGHT;
223
else if (strcasecmp(strval, "LeftTop") == 0)
224
m_value = FbWinFrame::LEFTTOP;
225
else if (strcasecmp(strval, "Left") == 0)
226
m_value = FbWinFrame::LEFT;
227
else if (strcasecmp(strval, "LeftBottom") == 0)
228
m_value = FbWinFrame::LEFTBOTTOM;
229
else if (strcasecmp(strval, "RightTop") == 0)
230
m_value = FbWinFrame::RIGHTTOP;
231
else if (strcasecmp(strval, "Right") == 0)
232
m_value = FbWinFrame::RIGHT;
233
else if (strcasecmp(strval, "RightBottom") == 0)
234
m_value = FbWinFrame::RIGHTBOTTOM;
240
212
string FbTk::Resource<FbWinFrame::TabPlacement>::
241
213
getString() const {
242
214
switch (m_value) {
281
253
return string("TopLeft");
257
void FbTk::Resource<FbWinFrame::TabPlacement>::
258
setFromString(const char *strval) {
259
if (strcasecmp(strval, "TopLeft") == 0)
260
m_value = FbWinFrame::TOPLEFT;
261
else if (strcasecmp(strval, "BottomLeft") == 0)
262
m_value = FbWinFrame::BOTTOMLEFT;
263
else if (strcasecmp(strval, "Top") == 0)
264
m_value = FbWinFrame::TOP;
265
else if (strcasecmp(strval, "Bottom") == 0)
266
m_value = FbWinFrame::BOTTOM;
267
else if (strcasecmp(strval, "TopRight") == 0)
268
m_value = FbWinFrame::TOPRIGHT;
269
else if (strcasecmp(strval, "BottomRight") == 0)
270
m_value = FbWinFrame::BOTTOMRIGHT;
271
else if (strcasecmp(strval, "LeftTop") == 0)
272
m_value = FbWinFrame::LEFTTOP;
273
else if (strcasecmp(strval, "Left") == 0)
274
m_value = FbWinFrame::LEFT;
275
else if (strcasecmp(strval, "LeftBottom") == 0)
276
m_value = FbWinFrame::LEFTBOTTOM;
277
else if (strcasecmp(strval, "RightTop") == 0)
278
m_value = FbWinFrame::RIGHTTOP;
279
else if (strcasecmp(strval, "Right") == 0)
280
m_value = FbWinFrame::RIGHT;
281
else if (strcasecmp(strval, "RightBottom") == 0)
282
m_value = FbWinFrame::RIGHTBOTTOM;
283
287
} // end namespace FbTk
292
296
max_disable_move(rm, false, scrname+".maxDisableMove", altscrname+".MaxDisableMove"),
293
297
max_disable_resize(rm, false, scrname+".maxDisableResize", altscrname+".MaxDisableResize"),
294
298
workspace_warping(rm, true, scrname+".workspacewarping", altscrname+".WorkspaceWarping"),
295
show_window_pos(rm, true, scrname+".showwindowposition", altscrname+".ShowWindowPosition"),
299
show_window_pos(rm, false, scrname+".showwindowposition", altscrname+".ShowWindowPosition"),
296
300
auto_raise(rm, true, scrname+".autoRaise", altscrname+".AutoRaise"),
297
301
click_raises(rm, true, scrname+".clickRaises", altscrname+".ClickRaises"),
298
302
default_deco(rm, "NORMAL", scrname+".defaultDeco", altscrname+".DefaultDeco"),
299
rootcommand(rm, "", scrname+".rootCommand", altscrname+".RootCommand"),
300
303
tab_placement(rm, FbWinFrame::TOPLEFT, scrname+".tab.placement", altscrname+".Tab.Placement"),
301
304
windowmenufile(rm, Fluxbox::instance()->getDefaultDataFilename("windowmenu"), scrname+".windowMenu", altscrname+".WindowMenu"),
302
305
typing_delay(rm, 0, scrname+".noFocusWhileTypingDelay", altscrname+".NoFocusWhileTypingDelay"),
303
follow_model(rm, SEMIFOLLOW_ACTIVE_WINDOW, scrname+".followModel", altscrname+".followModel"),
304
user_follow_model(rm, SEMIFOLLOW_ACTIVE_WINDOW, scrname+".userFollowModel", altscrname+".UserFollowModel"),
305
306
workspaces(rm, 4, scrname+".workspaces", altscrname+".Workspaces"),
306
307
edge_snap_threshold(rm, 10, scrname+".edgeSnapThreshold", altscrname+".EdgeSnapThreshold"),
307
308
focused_alpha(rm, 255, scrname+".window.focus.alpha", altscrname+".Window.Focus.Alpha"),
308
309
unfocused_alpha(rm, 255, scrname+".window.unfocus.alpha", altscrname+".Window.Unfocus.Alpha"),
309
310
menu_alpha(rm, 255, scrname+".menu.alpha", altscrname+".Menu.Alpha"),
310
311
menu_delay(rm, 200, scrname + ".menuDelay", altscrname+".MenuDelay"),
311
menu_delay_close(rm, 200, scrname + ".menuDelayClose", altscrname+".MenuDelayClose"),
312
312
tab_width(rm, 64, scrname + ".tab.width", altscrname+".Tab.Width"),
313
313
tooltip_delay(rm, 500, scrname + ".tooltipDelay", altscrname+".TooltipDelay"),
314
menu_mode(rm, FbTk::MenuTheme::DELAY_OPEN, scrname+".menuMode", altscrname+".MenuMode"),
316
gc_line_width(rm, 1, scrname+".overlay.lineWidth", altscrname+".Overlay.LineWidth"),
318
FbTk::GContext::LINESOLID,
319
scrname+".overlay.lineStyle",
320
altscrname+".Overlay.LineStyle"),
322
FbTk::GContext::JOINMITER,
323
scrname+".overlay.joinStyle",
324
altscrname+".Overlay.JoinStyle"),
326
FbTk::GContext::CAPNOTLAST,
327
scrname+".overlay.capStyle",
328
altscrname+".overlay.CapStyle"),
329
314
allow_remote_actions(rm, false, scrname+".allowRemoteActions", altscrname+".AllowRemoteActions"),
330
315
clientmenu_use_pixmap(rm, true, scrname+".clientMenu.usePixmap", altscrname+".ClientMenu.UsePixmap"),
331
316
tabs_use_pixmap(rm, true, scrname+".tabs.usePixmap", altscrname+".Tabs.UsePixmap"),
339
324
const string &screenname,
340
325
const string &altscreenname,
341
326
int scrn, int num_layers) :
342
m_clientlist_sig(*this), // client signal
343
m_iconlist_sig(*this), // icon list signal
344
m_workspacecount_sig(*this), // workspace count signal
345
m_workspacenames_sig(*this), // workspace names signal
346
m_workspace_area_sig(*this), // workspace area signal
347
m_currentworkspace_sig(*this), // current workspace signal
348
m_focusedwindow_sig(*this), // focused window signal
349
327
m_reconfigure_sig(*this), // reconfigure signal
351
m_bg_change_sig(*this),
352
328
m_layermanager(num_layers),
353
329
m_focused_windowtheme(new FbWinFrameTheme(scrn, ".focus", ".Focus")),
354
330
m_unfocused_windowtheme(new FbWinFrameTheme(scrn, ".unfocus", ".Unfocus")),
470
446
imageControl().installRootColormap();
471
447
root_colormap_installed = true;
473
// if user specified background in the config then use it
474
if (!resource.rootcommand->empty()) {
475
FbCommands::ExecuteCmd cmd(*resource.rootcommand, screenNumber());
479
449
m_root_theme.reset(new RootTheme(imageControl()));
480
450
m_root_theme->reconfigTheme();
482
452
focusedWinFrameTheme()->setAlpha(*resource.focused_alpha);
483
453
unfocusedWinFrameTheme()->setAlpha(*resource.unfocused_alpha);
484
454
m_menutheme->setAlpha(*resource.menu_alpha);
485
m_menutheme->setMenuMode(*resource.menu_mode);
487
456
if (*resource.menu_delay > 5000)
488
457
*resource.menu_delay = 5000;
489
458
if (*resource.menu_delay < 0)
490
459
*resource.menu_delay = 0;
492
if (*resource.menu_delay_close > 5000)
493
*resource.menu_delay_close = 5000;
494
if (*resource.menu_delay_close < 0)
495
*resource.menu_delay_close = 0;
497
m_menutheme->setDelayOpen(*resource.menu_delay);
498
m_menutheme->setDelayClose(*resource.menu_delay_close);
461
m_menutheme->setDelay(*resource.menu_delay);
500
463
focusedWinFrameTheme()->reconfigSig().attach(this);// for geom window
859
813
// TODO: this doesn't belong in FbPixmap
860
814
} else if (FbTk::FbPixmap::rootwinPropertyNotify(screenNumber(), atom))
861
m_bg_change_sig.notify();
815
m_bg_change_sig.emit(*this);
864
818
void BScreen::keyPressEvent(XKeyEvent &ke) {
865
Fluxbox::instance()->keys()->doAction(ke.type, ke.state, ke.keycode,
866
Keys::GLOBAL|Keys::ON_DESKTOP);
819
if (Fluxbox::instance()->keys()->doAction(ke.type, ke.state, ke.keycode,
820
Keys::GLOBAL|Keys::ON_DESKTOP))
821
// re-grab keyboard, so we don't pass KeyRelease to clients
822
// also for catching invalid keys in the middle of keychains
823
FbTk::EventManager::instance()->grabKeyboard(rootWindow().window());
869
827
void BScreen::keyReleaseEvent(XKeyEvent &ke) {
873
unsigned int state = FbTk::KeyUtil::instance().cleanMods(ke.state);
874
state &= ~FbTk::KeyUtil::instance().keycodeToModmask(ke.keycode);
876
if (!state) // all modifiers were released
829
unsigned int state = FbTk::KeyUtil::instance().cleanMods(ke.state);
830
state &= ~FbTk::KeyUtil::instance().keycodeToModmask(ke.keycode);
832
if (state) // still cycling
836
focusControl().stopCyclingFocus();
838
if (!Fluxbox::instance()->keys()->inKeychain())
877
839
FbTk::EventManager::instance()->ungrabKeyboard();
2061
2006
if (!hasXinerama()) return;
2063
2008
for (Workspaces::iterator i = m_workspaces_list.begin();
2064
i != m_workspaces_list.end(); i++) {
2065
for (Workspace::Windows::iterator win = (*i)->windowList().begin();
2066
win != (*i)->windowList().end(); win++) {
2067
if (getHead((*win)->fbWindow()) == 0) {
2068
// first head is a safe bet here
2069
(*win)->placeWindow(1);
2009
i != m_workspaces_list.end(); i++) {
2010
for (Workspace::Windows::iterator win = (*i)->windowList().begin();
2011
win != (*i)->windowList().end(); win++) {
2013
int closest_head = getHead((*win)->fbWindow());
2014
if (closest_head == 0) {
2015
closest_head = 1; // first head is a safe bet here
2017
(*win)->placeWindow(closest_head);
2075
2022
int BScreen::getHead(int x, int y) const {
2076
if (!hasXinerama()) return 0;
2077
2024
#ifdef XINERAMA
2079
for (int i=0; i < m_xinerama_num_heads; i++) {
2080
if (x >= m_xinerama_headinfo[i].x &&
2081
x < (m_xinerama_headinfo[i].x + m_xinerama_headinfo[i].width) &&
2082
y >= m_xinerama_headinfo[i].y &&
2083
y < (m_xinerama_headinfo[i].y + m_xinerama_headinfo[i].height)) {
2025
if (hasXinerama()) {
2026
for (int i=0; i < m_xinerama_num_heads; i++) {
2027
if (x >= m_xinerama_headinfo[i].x &&
2028
x < (m_xinerama_headinfo[i].x + m_xinerama_headinfo[i].width) &&
2029
y >= m_xinerama_headinfo[i].y &&
2030
y < (m_xinerama_headinfo[i].y + m_xinerama_headinfo[i].height)) {
2088
2035
#endif // XINERAMA
2092
2040
int BScreen::getHead(const FbTk::FbWindow &win) const {
2094
return getHead(win.x() + win.width()/2, win.y() + win.height()/2);
2042
int head = 0; // whole screen
2045
if (hasXinerama()) {
2047
// cast needed to prevent win.x() become "unsigned int" which is bad
2048
// since it might become negative
2049
int cx = win.x() + static_cast<int>(win.width() / 2);
2050
int cy = win.y() + static_cast<int>(win.height() / 2);
2055
for (i = 0; i < m_xinerama_num_heads; ++i) {
2057
XineramaHeadInfo& hi = m_xinerama_headinfo[i];
2058
int d = calcSquareDistance(cx, cy, hi.x + (hi.width / 2), hi.y + (hi.height / 2));
2060
if (dist == -1 || d < dist) { // found a closer head