configuration changes "done"!!
on start, the config file is read entirely off the disc, and missing values are assigned defaults. the config file is immediately written back to the disk to populate missing defaults in the file. any time a config option is changed the control, the config file is re-written with the change. choosing reconfig will reload the current config file on the disc. on shutdown, nothing is written to the config file.
This commit is contained in:
parent
66c879bd5c
commit
9cd9d92bb1
12 changed files with 586 additions and 509 deletions
|
@ -1,6 +1,13 @@
|
||||||
Changelog for Openbox:
|
Changelog for Openbox:
|
||||||
|
|
||||||
1.0.0:
|
1.0.0:
|
||||||
|
* better handling of teh rc file and its configuration
|
||||||
|
options. The file is written each time an option in
|
||||||
|
the file is changed, instead of being written at
|
||||||
|
shutdown. This means that you can edit the file by
|
||||||
|
hand while in Openbox, and then choose reconfig or
|
||||||
|
restart to have it use the new rc file. (Ben Jansens)
|
||||||
|
|
||||||
* added a runtime option for hiding the toolbar. (Scott Moynes)
|
* added a runtime option for hiding the toolbar. (Scott Moynes)
|
||||||
|
|
||||||
* made shaded windows edge-snap correctly to the
|
* made shaded windows edge-snap correctly to the
|
||||||
|
|
|
@ -64,10 +64,10 @@ Configmenu::Configmenu(BScreen &scr) : Basemenu(scr), screen(scr)
|
||||||
update();
|
update();
|
||||||
|
|
||||||
setItemSelected(2, screen.getImageControl()->doDither());
|
setItemSelected(2, screen.getImageControl()->doDither());
|
||||||
setItemSelected(3, screen.doOpaqueMove());
|
setItemSelected(3, screen.opaqueMove());
|
||||||
setItemSelected(4, screen.doFullMax());
|
setItemSelected(4, screen.fullMax());
|
||||||
setItemSelected(5, screen.doFocusNew());
|
setItemSelected(5, screen.focusNew());
|
||||||
setItemSelected(6, screen.doFocusLast());
|
setItemSelected(6, screen.focusLast());
|
||||||
setItemSelected(7, screen.hideToolbar());
|
setItemSelected(7, screen.hideToolbar());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,30 +96,30 @@ void Configmenu::itemSelected(int button, int index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case 2: { // opaque move
|
case 2: { // opaque move
|
||||||
screen.saveOpaqueMove((! screen.doOpaqueMove()));
|
screen.setOpaqueMove(!screen.opaqueMove());
|
||||||
|
|
||||||
setItemSelected(index, screen.doOpaqueMove());
|
setItemSelected(index, screen.opaqueMove());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 3: { // full maximization
|
case 3: { // full maximization
|
||||||
screen.saveFullMax((! screen.doFullMax()));
|
screen.setFullMax(!screen.fullMax());
|
||||||
|
|
||||||
setItemSelected(index, screen.doFullMax());
|
setItemSelected(index, screen.fullMax());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4: { // focus new windows
|
case 4: { // focus new windows
|
||||||
screen.saveFocusNew((! screen.doFocusNew()));
|
screen.setFocusNew(!screen.focusNew());
|
||||||
|
|
||||||
setItemSelected(index, screen.doFocusNew());
|
setItemSelected(index, screen.focusNew());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 5: { // focus last window on workspace
|
case 5: { // focus last window on workspace
|
||||||
screen.saveFocusLast(!(screen.doFocusLast()));
|
screen.setFocusLast(!screen.focusLast());
|
||||||
setItemSelected(index, screen.doFocusLast());
|
setItemSelected(index, screen.focusLast());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 6:{ //toggle toolbar hide
|
case 6:{ //toggle toolbar hide
|
||||||
|
@ -152,10 +152,10 @@ Configmenu::Focusmenu::Focusmenu(Configmenu *cm) : Basemenu(cm->screen) {
|
||||||
"Auto Raise"), 3);
|
"Auto Raise"), 3);
|
||||||
update();
|
update();
|
||||||
|
|
||||||
setItemSelected(0, (! configmenu->screen.isSloppyFocus()));
|
setItemSelected(0, !configmenu->screen.sloppyFocus());
|
||||||
setItemSelected(1, configmenu->screen.isSloppyFocus());
|
setItemSelected(1, configmenu->screen.sloppyFocus());
|
||||||
setItemEnabled(2, configmenu->screen.isSloppyFocus());
|
setItemEnabled(2, configmenu->screen.sloppyFocus());
|
||||||
setItemSelected(2, configmenu->screen.doAutoRaise());
|
setItemSelected(2, configmenu->screen.autoRaise());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Configmenu::Focusmenu::itemSelected(int button, int index) {
|
void Configmenu::Focusmenu::itemSelected(int button, int index) {
|
||||||
|
@ -169,8 +169,8 @@ void Configmenu::Focusmenu::itemSelected(int button, int index) {
|
||||||
|
|
||||||
switch (item->function()) {
|
switch (item->function()) {
|
||||||
case 1: // click to focus
|
case 1: // click to focus
|
||||||
configmenu->screen.saveSloppyFocus(False);
|
configmenu->screen.setSloppyFocus(false);
|
||||||
configmenu->screen.saveAutoRaise(False);
|
configmenu->screen.setAutoRaise(false);
|
||||||
|
|
||||||
if (! configmenu->screen.getOpenbox().getFocusedWindow())
|
if (! configmenu->screen.getOpenbox().getFocusedWindow())
|
||||||
XSetInputFocus(configmenu->screen.getOpenbox().getXDisplay(),
|
XSetInputFocus(configmenu->screen.getOpenbox().getXDisplay(),
|
||||||
|
@ -187,23 +187,23 @@ void Configmenu::Focusmenu::itemSelected(int button, int index) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // sloppy focus
|
case 2: // sloppy focus
|
||||||
configmenu->screen.saveSloppyFocus(True);
|
configmenu->screen.setSloppyFocus(true);
|
||||||
|
|
||||||
configmenu->screen.reconfigure();
|
configmenu->screen.reconfigure();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: // auto raise with sloppy focus
|
case 3: // auto raise with sloppy focus
|
||||||
Bool change = ((configmenu->screen.doAutoRaise()) ? False : True);
|
bool change = ((configmenu->screen.autoRaise()) ? false : true);
|
||||||
configmenu->screen.saveAutoRaise(change);
|
configmenu->screen.setAutoRaise(change);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
setItemSelected(0, (! configmenu->screen.isSloppyFocus()));
|
setItemSelected(0, !configmenu->screen.sloppyFocus());
|
||||||
setItemSelected(1, configmenu->screen.isSloppyFocus());
|
setItemSelected(1, configmenu->screen.sloppyFocus());
|
||||||
setItemEnabled(2, configmenu->screen.isSloppyFocus());
|
setItemEnabled(2, configmenu->screen.sloppyFocus());
|
||||||
setItemSelected(2, configmenu->screen.doAutoRaise());
|
setItemSelected(2, configmenu->screen.autoRaise());
|
||||||
}
|
}
|
||||||
|
|
||||||
Configmenu::Placementmenu::Placementmenu(Configmenu *cm) :
|
Configmenu::Placementmenu::Placementmenu(Configmenu *cm) :
|
||||||
|
@ -234,7 +234,7 @@ Configmenu::Placementmenu::Placementmenu(Configmenu *cm) :
|
||||||
"Bottom to Top"), BScreen::BottomTop);
|
"Bottom to Top"), BScreen::BottomTop);
|
||||||
update();
|
update();
|
||||||
|
|
||||||
switch (configmenu->screen.getPlacementPolicy()) {
|
switch (configmenu->screen.placementPolicy()) {
|
||||||
case BScreen::RowSmartPlacement:
|
case BScreen::RowSmartPlacement:
|
||||||
setItemSelected(0, True);
|
setItemSelected(0, True);
|
||||||
break;
|
break;
|
||||||
|
@ -252,16 +252,16 @@ Configmenu::Placementmenu::Placementmenu(Configmenu *cm) :
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool rl = (configmenu->screen.getRowPlacementDirection() ==
|
Bool rl = (configmenu->screen.rowPlacementDirection() ==
|
||||||
BScreen::LeftRight),
|
BScreen::LeftRight),
|
||||||
tb = (configmenu->screen.getColPlacementDirection() ==
|
tb = (configmenu->screen.colPlacementDirection() ==
|
||||||
BScreen::TopBottom);
|
BScreen::TopBottom);
|
||||||
|
|
||||||
setItemSelected(4, rl);
|
setItemSelected(4, rl);
|
||||||
setItemSelected(5, ! rl);
|
setItemSelected(5, !rl);
|
||||||
|
|
||||||
setItemSelected(6, tb);
|
setItemSelected(6, tb);
|
||||||
setItemSelected(7, ! tb);
|
setItemSelected(7, !tb);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Configmenu::Placementmenu::itemSelected(int button, int index) {
|
void Configmenu::Placementmenu::itemSelected(int button, int index) {
|
||||||
|
@ -275,7 +275,7 @@ void Configmenu::Placementmenu::itemSelected(int button, int index) {
|
||||||
|
|
||||||
switch (item->function()) {
|
switch (item->function()) {
|
||||||
case BScreen::RowSmartPlacement:
|
case BScreen::RowSmartPlacement:
|
||||||
configmenu->screen.savePlacementPolicy(item->function());
|
configmenu->screen.setPlacementPolicy(item->function());
|
||||||
|
|
||||||
setItemSelected(0, True);
|
setItemSelected(0, True);
|
||||||
setItemSelected(1, False);
|
setItemSelected(1, False);
|
||||||
|
@ -285,7 +285,7 @@ void Configmenu::Placementmenu::itemSelected(int button, int index) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BScreen::ColSmartPlacement:
|
case BScreen::ColSmartPlacement:
|
||||||
configmenu->screen.savePlacementPolicy(item->function());
|
configmenu->screen.setPlacementPolicy(item->function());
|
||||||
|
|
||||||
setItemSelected(0, False);
|
setItemSelected(0, False);
|
||||||
setItemSelected(1, True);
|
setItemSelected(1, True);
|
||||||
|
@ -295,7 +295,7 @@ void Configmenu::Placementmenu::itemSelected(int button, int index) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BScreen::CascadePlacement:
|
case BScreen::CascadePlacement:
|
||||||
configmenu->screen.savePlacementPolicy(item->function());
|
configmenu->screen.setPlacementPolicy(item->function());
|
||||||
|
|
||||||
setItemSelected(0, False);
|
setItemSelected(0, False);
|
||||||
setItemSelected(1, False);
|
setItemSelected(1, False);
|
||||||
|
@ -305,7 +305,7 @@ void Configmenu::Placementmenu::itemSelected(int button, int index) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BScreen::BestFitPlacement:
|
case BScreen::BestFitPlacement:
|
||||||
configmenu->screen.savePlacementPolicy(item->function());
|
configmenu->screen.setPlacementPolicy(item->function());
|
||||||
|
|
||||||
setItemSelected(0, False);
|
setItemSelected(0, False);
|
||||||
setItemSelected(1, False);
|
setItemSelected(1, False);
|
||||||
|
@ -315,7 +315,7 @@ void Configmenu::Placementmenu::itemSelected(int button, int index) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BScreen::LeftRight:
|
case BScreen::LeftRight:
|
||||||
configmenu->screen.saveRowPlacementDirection(BScreen::LeftRight);
|
configmenu->screen.setRowPlacementDirection(BScreen::LeftRight);
|
||||||
|
|
||||||
setItemSelected(4, True);
|
setItemSelected(4, True);
|
||||||
setItemSelected(5, False);
|
setItemSelected(5, False);
|
||||||
|
@ -323,7 +323,7 @@ void Configmenu::Placementmenu::itemSelected(int button, int index) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BScreen::RightLeft:
|
case BScreen::RightLeft:
|
||||||
configmenu->screen.saveRowPlacementDirection(BScreen::RightLeft);
|
configmenu->screen.setRowPlacementDirection(BScreen::RightLeft);
|
||||||
|
|
||||||
setItemSelected(4, False);
|
setItemSelected(4, False);
|
||||||
setItemSelected(5, True);
|
setItemSelected(5, True);
|
||||||
|
@ -331,7 +331,7 @@ void Configmenu::Placementmenu::itemSelected(int button, int index) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BScreen::TopBottom:
|
case BScreen::TopBottom:
|
||||||
configmenu->screen.saveColPlacementDirection(BScreen::TopBottom);
|
configmenu->screen.setColPlacementDirection(BScreen::TopBottom);
|
||||||
|
|
||||||
setItemSelected(5, True);
|
setItemSelected(5, True);
|
||||||
setItemSelected(6, False);
|
setItemSelected(6, False);
|
||||||
|
@ -339,7 +339,7 @@ void Configmenu::Placementmenu::itemSelected(int button, int index) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BScreen::BottomTop:
|
case BScreen::BottomTop:
|
||||||
configmenu->screen.saveColPlacementDirection(BScreen::BottomTop);
|
configmenu->screen.setColPlacementDirection(BScreen::BottomTop);
|
||||||
|
|
||||||
setItemSelected(5, False);
|
setItemSelected(5, False);
|
||||||
setItemSelected(6, True);
|
setItemSelected(6, True);
|
||||||
|
|
411
src/Screen.cc
411
src/Screen.cc
|
@ -189,6 +189,28 @@ static const char *getFontSize(const char *pattern, int *size) {
|
||||||
BScreen::BScreen(Openbox &ob, int scrn, Resource &conf) : ScreenInfo(ob, scrn),
|
BScreen::BScreen(Openbox &ob, int scrn, Resource &conf) : ScreenInfo(ob, scrn),
|
||||||
openbox(ob), config(conf)
|
openbox(ob), config(conf)
|
||||||
{
|
{
|
||||||
|
// default values
|
||||||
|
resource.full_max = false;
|
||||||
|
resource.focus_new = false;
|
||||||
|
resource.focus_last = false;
|
||||||
|
resource.row_direction = LeftRight;
|
||||||
|
resource.col_direction = TopBottom;
|
||||||
|
resource.workspaces = 1;
|
||||||
|
resource.sloppy_focus = true;
|
||||||
|
resource.auto_raise = false;
|
||||||
|
resource.zones = 1;
|
||||||
|
resource.placement_policy = CascadePlacement;
|
||||||
|
#ifdef HAVE_STRFTIME
|
||||||
|
resource.strftime_format = bstrdup("%I:%M %p");
|
||||||
|
#else // !have_strftime
|
||||||
|
resource.date_format = B_AmericanDate;
|
||||||
|
resource.clock24hour = false;
|
||||||
|
#endif // HAVE_STRFTIME
|
||||||
|
resource.edge_snap_threshold = 4;
|
||||||
|
resource.image_dither = true;
|
||||||
|
resource.root_command = NULL;
|
||||||
|
resource.opaque_move = false;
|
||||||
|
|
||||||
event_mask = ColormapChangeMask | EnterWindowMask | PropertyChangeMask |
|
event_mask = ColormapChangeMask | EnterWindowMask | PropertyChangeMask |
|
||||||
SubstructureRedirectMask | KeyPressMask | KeyReleaseMask |
|
SubstructureRedirectMask | KeyPressMask | KeyReleaseMask |
|
||||||
ButtonPressMask | ButtonReleaseMask;
|
ButtonPressMask | ButtonReleaseMask;
|
||||||
|
@ -213,11 +235,6 @@ BScreen::BScreen(Openbox &ob, int scrn, Resource &conf) : ScreenInfo(ob, scrn),
|
||||||
resource.tstyle.fontset = resource.wstyle.fontset = (XFontSet) 0;
|
resource.tstyle.fontset = resource.wstyle.fontset = (XFontSet) 0;
|
||||||
resource.mstyle.t_font = resource.mstyle.f_font = resource.tstyle.font =
|
resource.mstyle.t_font = resource.mstyle.f_font = resource.tstyle.font =
|
||||||
resource.wstyle.font = (XFontStruct *) 0;
|
resource.wstyle.font = (XFontStruct *) 0;
|
||||||
resource.root_command = NULL;
|
|
||||||
|
|
||||||
#ifdef HAVE_STRFTIME
|
|
||||||
resource.strftime_format = 0;
|
|
||||||
#endif // HAVE_STRFTIME
|
|
||||||
|
|
||||||
#ifdef HAVE_GETPID
|
#ifdef HAVE_GETPID
|
||||||
pid_t bpid = getpid();
|
pid_t bpid = getpid();
|
||||||
|
@ -232,6 +249,9 @@ BScreen::BScreen(Openbox &ob, int scrn, Resource &conf) : ScreenInfo(ob, scrn),
|
||||||
openbox.getSessionCursor());
|
openbox.getSessionCursor());
|
||||||
|
|
||||||
workspaceNames = new LinkedList<char>;
|
workspaceNames = new LinkedList<char>;
|
||||||
|
|
||||||
|
load(); // load config options from Resources
|
||||||
|
|
||||||
workspacesList = new LinkedList<Workspace>;
|
workspacesList = new LinkedList<Workspace>;
|
||||||
rootmenuList = new LinkedList<Rootmenu>;
|
rootmenuList = new LinkedList<Rootmenu>;
|
||||||
netizenList = new LinkedList<Netizen>;
|
netizenList = new LinkedList<Netizen>;
|
||||||
|
@ -243,8 +263,6 @@ BScreen::BScreen(Openbox &ob, int scrn, Resource &conf) : ScreenInfo(ob, scrn),
|
||||||
image_control->installRootColormap();
|
image_control->installRootColormap();
|
||||||
root_colormap_installed = True;
|
root_colormap_installed = True;
|
||||||
|
|
||||||
openbox.load_rc(this);
|
|
||||||
|
|
||||||
image_control->setDither(resource.image_dither);
|
image_control->setDither(resource.image_dither);
|
||||||
|
|
||||||
LoadStyle();
|
LoadStyle();
|
||||||
|
@ -404,11 +422,13 @@ BScreen::BScreen(Openbox &ob, int scrn, Resource &conf) : ScreenInfo(ob, scrn),
|
||||||
for (int i = 0; i < resource.workspaces; ++i) {
|
for (int i = 0; i < resource.workspaces; ++i) {
|
||||||
wkspc = new Workspace(*this, workspacesList->count());
|
wkspc = new Workspace(*this, workspacesList->count());
|
||||||
workspacesList->insert(wkspc);
|
workspacesList->insert(wkspc);
|
||||||
|
saveWorkspaceNames();
|
||||||
workspacemenu->insert(wkspc->getName(), wkspc->getMenu());
|
workspacemenu->insert(wkspc->getName(), wkspc->getMenu());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wkspc = new Workspace(*this, workspacesList->count());
|
wkspc = new Workspace(*this, workspacesList->count());
|
||||||
workspacesList->insert(wkspc);
|
workspacesList->insert(wkspc);
|
||||||
|
saveWorkspaceNames();
|
||||||
workspacemenu->insert(wkspc->getName(), wkspc->getMenu());
|
workspacemenu->insert(wkspc->getName(), wkspc->getMenu());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -824,6 +844,210 @@ XFontSet BScreen::createFontSet(const char *fontname) {
|
||||||
return fs;
|
return fs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BScreen::setSloppyFocus(bool b) {
|
||||||
|
resource.sloppy_focus = b;
|
||||||
|
ostrstream s;
|
||||||
|
s << "session.screen" << getScreenNumber() << ".focusModel" << ends;
|
||||||
|
config.setValue(s.str(),
|
||||||
|
(resource.sloppy_focus ?
|
||||||
|
(resource.auto_raise ? "AutoRaiseSloppyFocus" : "SloppyFocus")
|
||||||
|
: "ClickToFocus"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void BScreen::setAutoRaise(bool a) {
|
||||||
|
resource.auto_raise = a;
|
||||||
|
ostrstream s;
|
||||||
|
s << "session.screen" << getScreenNumber() << ".focusModel" << ends;
|
||||||
|
config.setValue(s.str(),
|
||||||
|
(resource.sloppy_focus ?
|
||||||
|
(resource.auto_raise ? "AutoRaiseSloppyFocus" : "SloppyFocus")
|
||||||
|
: "ClickToFocus"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void BScreen::setImageDither(bool d) {
|
||||||
|
resource.image_dither = d;
|
||||||
|
ostrstream s;
|
||||||
|
s << "session.screen" << getScreenNumber() << ".imageDither" << ends;
|
||||||
|
config.setValue(s.str(), resource.image_dither);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BScreen::setOpaqueMove(bool o) {
|
||||||
|
resource.opaque_move = o;
|
||||||
|
ostrstream s;
|
||||||
|
s << "session.screen" << getScreenNumber() << ".opaqueMove" << ends;
|
||||||
|
config.setValue(s.str(), resource.opaque_move);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BScreen::setFullMax(bool f) {
|
||||||
|
resource.full_max = f;
|
||||||
|
ostrstream s;
|
||||||
|
s << "session.screen" << getScreenNumber() << ".fullMaximization" << ends;
|
||||||
|
config.setValue(s.str(), resource.full_max);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BScreen::setFocusNew(bool f) {
|
||||||
|
resource.focus_new = f;
|
||||||
|
ostrstream s;
|
||||||
|
s << "session.screen" << getScreenNumber() << ".focusNewWindows" << ends;
|
||||||
|
config.setValue(s.str(), resource.focus_new);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BScreen::setFocusLast(bool f) {
|
||||||
|
resource.focus_last = f;
|
||||||
|
ostrstream s;
|
||||||
|
s << "session.screen" << getScreenNumber() << ".focusLastWindow" << ends;
|
||||||
|
config.setValue(s.str(), resource.focus_last);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BScreen::setWindowZones(int z) {
|
||||||
|
resource.zones = z;
|
||||||
|
ostrstream s;
|
||||||
|
s << "session.screen" << getScreenNumber() << ".windowZones" << ends;
|
||||||
|
config.setValue(s.str(), resource.zones);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BScreen::setWorkspaceCount(int w) {
|
||||||
|
resource.workspaces = w;
|
||||||
|
ostrstream s;
|
||||||
|
s << "session.screen" << getScreenNumber() << ".workspaces" << ends;
|
||||||
|
config.setValue(s.str(), resource.workspaces);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BScreen::setPlacementPolicy(int p) {
|
||||||
|
resource.placement_policy = p;
|
||||||
|
ostrstream s;
|
||||||
|
s << "session.screen" << getScreenNumber() << ".windowPlacement" << ends;
|
||||||
|
const char *placement;
|
||||||
|
switch (resource.placement_policy) {
|
||||||
|
case CascadePlacement: placement = "CascadePlacement"; break;
|
||||||
|
case BestFitPlacement: placement = "BestFitPlacement"; break;
|
||||||
|
case ColSmartPlacement: placement = "ColSmartPlacement"; break;
|
||||||
|
default:
|
||||||
|
case RowSmartPlacement: placement = "RowSmartPlacement"; break;
|
||||||
|
}
|
||||||
|
config.setValue(s.str(), placement);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BScreen::setEdgeSnapThreshold(int t) {
|
||||||
|
resource.edge_snap_threshold = t;
|
||||||
|
ostrstream s;
|
||||||
|
s << "session.screen" << getScreenNumber() << ".edgeSnapThreshold" << ends;
|
||||||
|
config.setValue(s.str(), resource.edge_snap_threshold);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BScreen::setRowPlacementDirection(int d) {
|
||||||
|
resource.row_direction = d;
|
||||||
|
ostrstream s;
|
||||||
|
s << "session.screen" << getScreenNumber() << ".rowPlacementDirection" <<
|
||||||
|
ends;
|
||||||
|
config.setValue(s.str(),
|
||||||
|
resource.row_direction == LeftRight ?
|
||||||
|
"LeftToRight" : "RightToLeft");
|
||||||
|
}
|
||||||
|
|
||||||
|
void BScreen::setColPlacementDirection(int d) {
|
||||||
|
resource.col_direction = d;
|
||||||
|
ostrstream s;
|
||||||
|
s << "session.screen" << getScreenNumber() << ".colPlacementDirection" <<
|
||||||
|
ends;
|
||||||
|
config.setValue(s.str(),
|
||||||
|
resource.col_direction == TopBottom ?
|
||||||
|
"TopToBottom" : "BottomToTop");
|
||||||
|
}
|
||||||
|
|
||||||
|
void BScreen::setRootCommand(const char *cmd) {
|
||||||
|
if (resource.root_command != NULL)
|
||||||
|
delete [] resource.root_command;
|
||||||
|
if (cmd != NULL)
|
||||||
|
resource.root_command = bstrdup(cmd);
|
||||||
|
else
|
||||||
|
resource.root_command = NULL;
|
||||||
|
// this doesn't save to the Resources config because it can't be changed
|
||||||
|
// inside Openbox, and this way we dont add an empty command which would over-
|
||||||
|
// ride the styles commend when none has been specified
|
||||||
|
}
|
||||||
|
#ifdef HAVE_STRFTIME
|
||||||
|
void BScreen::setStrftimeFormat(const char *f) {
|
||||||
|
if (resource.strftime_format != NULL)
|
||||||
|
delete [] resource.strftime_format;
|
||||||
|
|
||||||
|
resource.strftime_format = bstrdup(f);
|
||||||
|
ostrstream s;
|
||||||
|
s << "session.screen" << getScreenNumber() << ".strftimeFormat" << ends;
|
||||||
|
config.setValue(s.str(), resource.strftime_format);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else // !HAVE_STRFTIME
|
||||||
|
void BScreen::setDateFormat(int f) {
|
||||||
|
resource.date_format = f;
|
||||||
|
ostrstream s;
|
||||||
|
s << "session.screen" << getScreenNumber() << ".dateFormat" << ends;
|
||||||
|
config.setValue(s.str(), resource.date_format == B_EuropeanDate ?
|
||||||
|
"European" : "American");
|
||||||
|
}
|
||||||
|
|
||||||
|
void BScreen::setClock24Hour(Bool c) {
|
||||||
|
resource.clock24hour = c;
|
||||||
|
ostrstream s;
|
||||||
|
s << "session.screen" << getScreenNumber() << ".clockFormat" << ends;
|
||||||
|
config.setValue(s.str(), resource.clock24hour ? 24 : 12);
|
||||||
|
}
|
||||||
|
#endif // HAVE_STRFTIME
|
||||||
|
|
||||||
|
void BScreen::setHideToolbar(bool b) {
|
||||||
|
resource.hide_toolbar = b;
|
||||||
|
if (resource.hide_toolbar)
|
||||||
|
getToolbar()->unMapToolbar();
|
||||||
|
else
|
||||||
|
getToolbar()->mapToolbar();
|
||||||
|
ostrstream s;
|
||||||
|
s << "session.screen" << getScreenNumber() << ".hideToolbar" << ends;
|
||||||
|
config.setValue(s.str(), resource.hide_toolbar ? "True" : "False");
|
||||||
|
}
|
||||||
|
|
||||||
|
void BScreen::saveWorkspaceNames() {
|
||||||
|
ostrstream rc, names;
|
||||||
|
|
||||||
|
for (int i = 0; i < resource.workspaces; i++) {
|
||||||
|
Workspace *w = getWorkspace(i);
|
||||||
|
if (w != NULL) {
|
||||||
|
names << w->getName();
|
||||||
|
if (i < resource.workspaces-1)
|
||||||
|
names << ',';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
names << ends;
|
||||||
|
|
||||||
|
rc << "session.screen" << getScreenNumber() << ".workspaceNames" << ends;
|
||||||
|
config.setValue(rc.str(), names.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
void BScreen::save() {
|
||||||
|
setSloppyFocus(resource.sloppy_focus);
|
||||||
|
setAutoRaise(resource.auto_raise);
|
||||||
|
setImageDither(resource.image_dither);
|
||||||
|
setOpaqueMove(resource.opaque_move);
|
||||||
|
setFullMax(resource.full_max);
|
||||||
|
setFocusNew(resource.focus_new);
|
||||||
|
setFocusLast(resource.focus_last);
|
||||||
|
setWindowZones(resource.zones);
|
||||||
|
setWorkspaceCount(resource.workspaces);
|
||||||
|
setPlacementPolicy(resource.placement_policy);
|
||||||
|
setEdgeSnapThreshold(resource.edge_snap_threshold);
|
||||||
|
setRowPlacementDirection(resource.row_direction);
|
||||||
|
setColPlacementDirection(resource.col_direction);
|
||||||
|
setRootCommand(resource.root_command);
|
||||||
|
#ifdef HAVE_STRFTIME
|
||||||
|
// it deletes the current value before setting the new one, so we have to
|
||||||
|
// duplicate the current value.
|
||||||
|
setStrftimeFormat(bstrdup(resource.strftime_format));
|
||||||
|
#else // !HAVE_STRFTIME
|
||||||
|
setDateFormat(resource.date_format);
|
||||||
|
setClock24Hour(resource.clock24hour);
|
||||||
|
#endif // HAVE_STRFTIME
|
||||||
|
setHideToolbar(resource.hide_toolbar);
|
||||||
|
}
|
||||||
|
|
||||||
void BScreen::load() {
|
void BScreen::load() {
|
||||||
std::ostrstream rscreen, rname, rclass;
|
std::ostrstream rscreen, rname, rclass;
|
||||||
std::string s;
|
std::string s;
|
||||||
|
@ -836,6 +1060,153 @@ void BScreen::load() {
|
||||||
if (config.getValue(rname.str(), rclass.str(), b))
|
if (config.getValue(rname.str(), rclass.str(), b))
|
||||||
resource.hide_toolbar = b;
|
resource.hide_toolbar = b;
|
||||||
|
|
||||||
|
rname.seekp(0); rclass.seekp(0);
|
||||||
|
rname << rscreen.str() << "fullMaximization" << ends;
|
||||||
|
rclass << rscreen.str() << "FullMaximization" << ends;
|
||||||
|
if (config.getValue(rname.str(), rclass.str(), b))
|
||||||
|
resource.full_max = b;
|
||||||
|
|
||||||
|
rname.seekp(0); rclass.seekp(0);
|
||||||
|
rname << rscreen.str() << "focusNewWindows" << ends;
|
||||||
|
rclass << rscreen.str() << "FocusNewWindows" << ends;
|
||||||
|
if (config.getValue(rname.str(), rclass.str(), b))
|
||||||
|
resource.focus_new = b;
|
||||||
|
|
||||||
|
rname.seekp(0); rclass.seekp(0);
|
||||||
|
rname << rscreen.str() << "focusLastWindow" << ends;
|
||||||
|
rclass << rscreen.str() << "FocusLastWindow" << ends;
|
||||||
|
if (config.getValue(rname.str(), rclass.str(), b))
|
||||||
|
resource.focus_last = b;
|
||||||
|
|
||||||
|
rname.seekp(0); rclass.seekp(0);
|
||||||
|
rname << rscreen.str() << "rowPlacementDirection" << ends;
|
||||||
|
rclass << rscreen.str() << "RowPlacementDirection" << ends;
|
||||||
|
if (config.getValue(rname.str(), rclass.str(), s)) {
|
||||||
|
if (0 == strncasecmp(s.c_str(), "RightToLeft", s.length()))
|
||||||
|
resource.row_direction = RightLeft;
|
||||||
|
else if (0 == strncasecmp(s.c_str(), "LeftToRight", s.length()))
|
||||||
|
resource.row_direction = LeftRight;
|
||||||
|
}
|
||||||
|
|
||||||
|
rname.seekp(0); rclass.seekp(0);
|
||||||
|
rname << rscreen.str() << "colPlacementDirection" << ends;
|
||||||
|
rclass << rscreen.str() << "ColPlacementDirection" << ends;
|
||||||
|
if (config.getValue(rname.str(), rclass.str(), s)) {
|
||||||
|
if (0 == strncasecmp(s.c_str(), "BottomToTop", s.length()))
|
||||||
|
resource.col_direction = BottomTop;
|
||||||
|
else if (0 == strncasecmp(s.c_str(), "TopToBottom", s.length()))
|
||||||
|
resource.col_direction = TopBottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
rname.seekp(0); rclass.seekp(0);
|
||||||
|
rname << rscreen.str() << "workspaces" << ends;
|
||||||
|
rclass << rscreen.str() << "Workspaces" << ends;
|
||||||
|
if (config.getValue(rname.str(), rclass.str(), l))
|
||||||
|
resource.workspaces = l;
|
||||||
|
|
||||||
|
removeWorkspaceNames();
|
||||||
|
rname.seekp(0); rclass.seekp(0);
|
||||||
|
rname << rscreen.str() << "workspaceNames" << ends;
|
||||||
|
rclass << rscreen.str() << "WorkspaceNames" << ends;
|
||||||
|
if (config.getValue(rname.str(), rclass.str(), s)) {
|
||||||
|
std::string::const_iterator it = s.begin(), end = s.end();
|
||||||
|
while(1) {
|
||||||
|
std::string::const_iterator tmp = it;// current string.begin()
|
||||||
|
it = std::find(tmp, end, ','); // look for comma between tmp and end
|
||||||
|
std::string name(tmp, it); // name = s[tmp:it]
|
||||||
|
addWorkspaceName(name.c_str());
|
||||||
|
if (it == end)
|
||||||
|
break;
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rname.seekp(0); rclass.seekp(0);
|
||||||
|
rname << rscreen.str() << "focusModel" << ends;
|
||||||
|
rclass << rscreen.str() << "FocusModel" << ends;
|
||||||
|
if (config.getValue(rname.str(), rclass.str(), s)) {
|
||||||
|
if (0 == strncasecmp(s.c_str(), "ClickToFocus", s.length())) {
|
||||||
|
resource.auto_raise = false;
|
||||||
|
resource.sloppy_focus = false;
|
||||||
|
} else if (0 == strncasecmp(s.c_str(), "AutoRaiseSloppyFocus",
|
||||||
|
s.length())) {
|
||||||
|
resource.sloppy_focus = true;
|
||||||
|
resource.auto_raise = true;
|
||||||
|
} else if (0 == strncasecmp(s.c_str(), "SloppyFocus", s.length())) {
|
||||||
|
resource.sloppy_focus = true;
|
||||||
|
resource.auto_raise = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rname.seekp(0); rclass.seekp(0);
|
||||||
|
rname << rscreen.str() << "windowZones" << ends;
|
||||||
|
rclass << rscreen.str() << "WindowZones" << ends;
|
||||||
|
if (config.getValue(rname.str(), rclass.str(), l))
|
||||||
|
resource.zones = (l == 1 || l == 2 || l == 4) ? l : 1;
|
||||||
|
|
||||||
|
rname.seekp(0); rclass.seekp(0);
|
||||||
|
rname << rscreen.str() << "windowPlacement" << ends;
|
||||||
|
rclass << rscreen.str() << "WindowPlacement" << ends;
|
||||||
|
if (config.getValue(rname.str(), rclass.str(), s)) {
|
||||||
|
if (0 == strncasecmp(s.c_str(), "RowSmartPlacement", s.length()))
|
||||||
|
resource.placement_policy = RowSmartPlacement;
|
||||||
|
else if (0 == strncasecmp(s.c_str(), "ColSmartPlacement", s.length()))
|
||||||
|
resource.placement_policy = ColSmartPlacement;
|
||||||
|
else if (0 == strncasecmp(s.c_str(), "BestFitPlacement", s.length()))
|
||||||
|
resource.placement_policy = BestFitPlacement;
|
||||||
|
else if (0 == strncasecmp(s.c_str(), "CascadePlacement", s.length()))
|
||||||
|
resource.placement_policy = CascadePlacement;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_STRFTIME
|
||||||
|
rname.seekp(0); rclass.seekp(0);
|
||||||
|
rname << rscreen.str() << "strftimeFormat" << ends;
|
||||||
|
rclass << rscreen.str() << "StrftimeFormat" << ends;
|
||||||
|
if (config.getValue(rname.str(), rclass.str(), s))
|
||||||
|
resource.strftime_format = bstrdup(s.c_str());
|
||||||
|
#else // !HAVE_STRFTIME
|
||||||
|
rname.seekp(0); rclass.seekp(0);
|
||||||
|
rname << rscreen.str() << "dateFormat" << ends;
|
||||||
|
rclass << rscreen.str() << "DateFormat" << ends;
|
||||||
|
if (config.getValue(rname.str(), rclass.str(), s)) {
|
||||||
|
if (strncasecmp(s.c_str(), "European", s.length()))
|
||||||
|
resource.date_format = B_EuropeanDate;
|
||||||
|
else if (strncasecmp(s.c_str(), "American", s.length()))
|
||||||
|
resource.date_format = B_AmericanDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
rname.seekp(0); rclass.seekp(0);
|
||||||
|
rname << rscreen.str() << "clockFormat" << ends;
|
||||||
|
rclass << rscreen.str() << "ClockFormat" << ends;
|
||||||
|
if (config.getValue(rname.str(), rclass.str(), l)) {
|
||||||
|
if (clock == 24)
|
||||||
|
resource.clock24hour = true;
|
||||||
|
else if (clock == 12)
|
||||||
|
resource.clock24hour = false;
|
||||||
|
#endif // HAVE_STRFTIME
|
||||||
|
|
||||||
|
rname.seekp(0); rclass.seekp(0);
|
||||||
|
rname << rscreen.str() << "edgeSnapThreshold" << ends;
|
||||||
|
rclass << rscreen.str() << "EdgeSnapThreshold" << ends;
|
||||||
|
if (config.getValue(rname.str(), rclass.str(), l))
|
||||||
|
resource.edge_snap_threshold = l;
|
||||||
|
|
||||||
|
rname.seekp(0); rclass.seekp(0);
|
||||||
|
rname << rscreen.str() << "imageDither" << ends;
|
||||||
|
rclass << rscreen.str() << "ImageDither" << ends;
|
||||||
|
if (config.getValue(rname.str(), rclass.str(), b))
|
||||||
|
resource.image_dither = b;
|
||||||
|
|
||||||
|
rname.seekp(0); rclass.seekp(0);
|
||||||
|
rname << rscreen.str() << "rootCommand" << ends;
|
||||||
|
rclass << rscreen.str() << "RootCommand" << ends;
|
||||||
|
if (config.getValue(rname.str(), rclass.str(), s))
|
||||||
|
resource.root_command = bstrdup(s.c_str());
|
||||||
|
|
||||||
|
rname.seekp(0); rclass.seekp(0);
|
||||||
|
rname << rscreen.str() << "opaqueMove" << ends;
|
||||||
|
rclass << rscreen.str() << "OpaqueMove" << ends;
|
||||||
|
resource.opaque_move = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BScreen::reconfigure(void) {
|
void BScreen::reconfigure(void) {
|
||||||
|
@ -1008,7 +1379,7 @@ void BScreen::rereadMenu(void) {
|
||||||
|
|
||||||
void BScreen::removeWorkspaceNames(void) {
|
void BScreen::removeWorkspaceNames(void) {
|
||||||
while (workspaceNames->count())
|
while (workspaceNames->count())
|
||||||
delete [] workspaceNames->remove(0);
|
delete [] workspaceNames->remove(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1362,6 +1733,7 @@ OpenboxWindow *BScreen::getIcon(int index) {
|
||||||
int BScreen::addWorkspace(void) {
|
int BScreen::addWorkspace(void) {
|
||||||
Workspace *wkspc = new Workspace(*this, workspacesList->count());
|
Workspace *wkspc = new Workspace(*this, workspacesList->count());
|
||||||
workspacesList->insert(wkspc);
|
workspacesList->insert(wkspc);
|
||||||
|
saveWorkspaceNames();
|
||||||
|
|
||||||
workspacemenu->insert(wkspc->getName(), wkspc->getMenu(),
|
workspacemenu->insert(wkspc->getName(), wkspc->getMenu(),
|
||||||
wkspc->getWorkspaceID() + 2);
|
wkspc->getWorkspaceID() + 2);
|
||||||
|
@ -1575,21 +1947,10 @@ void BScreen::raiseWindows(Window *workspace_stack, int num) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_STRFTIME
|
|
||||||
void BScreen::saveStrftimeFormat(const char *format) {
|
|
||||||
if (resource.strftime_format)
|
|
||||||
delete [] resource.strftime_format;
|
|
||||||
|
|
||||||
resource.strftime_format = bstrdup(format);
|
|
||||||
}
|
|
||||||
#endif // HAVE_STRFTIME
|
|
||||||
|
|
||||||
|
|
||||||
void BScreen::addWorkspaceName(const char *name) {
|
void BScreen::addWorkspaceName(const char *name) {
|
||||||
workspaceNames->insert(bstrdup(name));
|
workspaceNames->insert(bstrdup(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char* BScreen::getNameOfWorkspace(int id) {
|
char* BScreen::getNameOfWorkspace(int id) {
|
||||||
char *name = (char *) 0;
|
char *name = (char *) 0;
|
||||||
|
|
||||||
|
@ -2280,15 +2641,3 @@ void BScreen::hideGeometry(void) {
|
||||||
geom_visible = False;
|
geom_visible = False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BScreen::setHideToolbar(bool b) {
|
|
||||||
resource.hide_toolbar = b;
|
|
||||||
if (resource.hide_toolbar)
|
|
||||||
getToolbar()->unMapToolbar();
|
|
||||||
else
|
|
||||||
getToolbar()->mapToolbar();
|
|
||||||
ostrstream s;
|
|
||||||
s << "session.screen" << getScreenNumber() << ".hideToolbar" << ends;
|
|
||||||
config.setValue(s.str(), resource.hide_toolbar ? "True" : "False");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
130
src/Screen.h
130
src/Screen.h
|
@ -132,23 +132,21 @@ private:
|
||||||
ToolbarStyle tstyle;
|
ToolbarStyle tstyle;
|
||||||
MenuStyle mstyle;
|
MenuStyle mstyle;
|
||||||
|
|
||||||
Bool sloppy_focus, auto_raise,
|
bool sloppy_focus, auto_raise, auto_edge_balance, image_dither, focus_last,
|
||||||
auto_edge_balance, image_dither, ordered_dither, opaque_move, full_max,
|
ordered_dither, opaque_move, hide_toolbar, full_max, focus_new;
|
||||||
focus_new, focus_last;
|
|
||||||
bool hide_toolbar;
|
|
||||||
BColor border_color;
|
BColor border_color;
|
||||||
Resource styleconfig;
|
Resource styleconfig;
|
||||||
|
|
||||||
int workspaces, toolbar_placement, toolbar_width_percent, placement_policy,
|
int workspaces, placement_policy, edge_snap_threshold, row_direction,
|
||||||
edge_snap_threshold, row_direction, col_direction;
|
col_direction;
|
||||||
|
|
||||||
unsigned int handle_width, bevel_width, frame_width, border_width;
|
unsigned int handle_width, bevel_width, frame_width, border_width;
|
||||||
unsigned int zones; // number of zones to be used when alt-resizing a window
|
int zones; // number of zones to be used when alt-resizing a window
|
||||||
|
|
||||||
#ifdef HAVE_STRFTIME
|
#ifdef HAVE_STRFTIME
|
||||||
char *strftime_format;
|
char *strftime_format;
|
||||||
#else // !HAVE_STRFTIME
|
#else // !HAVE_STRFTIME
|
||||||
Bool clock24hour;
|
bool clock24hour;
|
||||||
int date_format;
|
int date_format;
|
||||||
#endif // HAVE_STRFTIME
|
#endif // HAVE_STRFTIME
|
||||||
|
|
||||||
|
@ -175,21 +173,7 @@ public:
|
||||||
BScreen(Openbox &, int, Resource &);
|
BScreen(Openbox &, int, Resource &);
|
||||||
~BScreen();
|
~BScreen();
|
||||||
|
|
||||||
inline const Bool &isSloppyFocus() const
|
|
||||||
{ return resource.sloppy_focus; }
|
|
||||||
inline const Bool &isRootColormapInstalled() const
|
|
||||||
{ return root_colormap_installed; }
|
|
||||||
inline const Bool &doAutoRaise() const { return resource.auto_raise; }
|
|
||||||
inline const Bool &isScreenManaged() const { return managed; }
|
inline const Bool &isScreenManaged() const { return managed; }
|
||||||
inline const Bool &doImageDither() const
|
|
||||||
{ return resource.image_dither; }
|
|
||||||
inline const Bool &doOrderedDither() const
|
|
||||||
{ return resource.ordered_dither; }
|
|
||||||
inline const Bool &doOpaqueMove() const { return resource.opaque_move; }
|
|
||||||
inline const Bool &doFullMax() const { return resource.full_max; }
|
|
||||||
inline const Bool &doFocusNew() const { return resource.focus_new; }
|
|
||||||
inline const Bool &doFocusLast() const { return resource.focus_last; }
|
|
||||||
|
|
||||||
inline const GC &getOpGC() const { return opGC; }
|
inline const GC &getOpGC() const { return opGC; }
|
||||||
|
|
||||||
inline Openbox &getOpenbox() { return openbox; }
|
inline Openbox &getOpenbox() { return openbox; }
|
||||||
|
@ -201,10 +185,6 @@ public:
|
||||||
inline Slit *getSlit() { return slit; }
|
inline Slit *getSlit() { return slit; }
|
||||||
#endif // SLIT
|
#endif // SLIT
|
||||||
|
|
||||||
inline int getWindowZones() const
|
|
||||||
{ return resource.zones; }
|
|
||||||
inline void saveWindowZones(int z) { resource.zones = z; }
|
|
||||||
|
|
||||||
inline Toolbar *getToolbar() { return toolbar; }
|
inline Toolbar *getToolbar() { return toolbar; }
|
||||||
|
|
||||||
inline Workspace *getWorkspace(int w) { return workspacesList->find(w); }
|
inline Workspace *getWorkspace(int w) { return workspacesList->find(w); }
|
||||||
|
@ -212,6 +192,8 @@ public:
|
||||||
|
|
||||||
inline Workspacemenu *getWorkspacemenu() { return workspacemenu; }
|
inline Workspacemenu *getWorkspacemenu() { return workspacemenu; }
|
||||||
|
|
||||||
|
inline void iconUpdate() { iconmenu->update(); }
|
||||||
|
|
||||||
inline const unsigned int &getHandleWidth() const
|
inline const unsigned int &getHandleWidth() const
|
||||||
{ return resource.handle_width; }
|
{ return resource.handle_width; }
|
||||||
inline const unsigned int &getBevelWidth() const
|
inline const unsigned int &getBevelWidth() const
|
||||||
|
@ -225,51 +207,63 @@ public:
|
||||||
{ return current_workspace->getWorkspaceID(); }
|
{ return current_workspace->getWorkspaceID(); }
|
||||||
inline const int getWorkspaceCount() { return workspacesList->count(); }
|
inline const int getWorkspaceCount() { return workspacesList->count(); }
|
||||||
inline const int getIconCount() { return iconList->count(); }
|
inline const int getIconCount() { return iconList->count(); }
|
||||||
inline const int &getNumberOfWorkspaces() const
|
|
||||||
{ return resource.workspaces; }
|
|
||||||
inline const int &getPlacementPolicy() const
|
|
||||||
{ return resource.placement_policy; }
|
|
||||||
inline const int &getEdgeSnapThreshold() const
|
|
||||||
{ return resource.edge_snap_threshold; }
|
|
||||||
inline const int &getRowPlacementDirection() const
|
|
||||||
{ return resource.row_direction; }
|
|
||||||
inline const int &getColPlacementDirection() const
|
|
||||||
{ return resource.col_direction; }
|
|
||||||
|
|
||||||
inline void saveRootCommand(const char *cmd) {
|
|
||||||
if (resource.root_command != NULL)
|
|
||||||
delete [] resource.root_command;
|
|
||||||
if (cmd != NULL)
|
|
||||||
resource.root_command = bstrdup(cmd);
|
|
||||||
else
|
|
||||||
resource.root_command = NULL;
|
|
||||||
}
|
|
||||||
inline const char *getRootCommand() const
|
|
||||||
{ return resource.root_command; }
|
|
||||||
|
|
||||||
|
inline const Bool &isRootColormapInstalled() const
|
||||||
|
{ return root_colormap_installed; }
|
||||||
inline void setRootColormapInstalled(Bool r) { root_colormap_installed = r; }
|
inline void setRootColormapInstalled(Bool r) { root_colormap_installed = r; }
|
||||||
inline void saveSloppyFocus(Bool s) { resource.sloppy_focus = s; }
|
|
||||||
inline void saveAutoRaise(Bool a) { resource.auto_raise = a; }
|
inline bool sloppyFocus() const { return resource.sloppy_focus; }
|
||||||
inline void saveWorkspaces(int w) { resource.workspaces = w; }
|
void setSloppyFocus(bool s);
|
||||||
inline void savePlacementPolicy(int p) { resource.placement_policy = p; }
|
|
||||||
inline void saveRowPlacementDirection(int d) { resource.row_direction = d; }
|
inline bool autoRaise() const { return resource.auto_raise; }
|
||||||
inline void saveColPlacementDirection(int d) { resource.col_direction = d; }
|
void setAutoRaise(bool a);
|
||||||
inline void saveEdgeSnapThreshold(int t)
|
|
||||||
{ resource.edge_snap_threshold = t; }
|
inline bool imageDither() const { return resource.image_dither; }
|
||||||
inline void saveImageDither(Bool d) { resource.image_dither = d; }
|
void setImageDither(bool d);
|
||||||
inline void saveOpaqueMove(Bool o) { resource.opaque_move = o; }
|
|
||||||
inline void saveFullMax(Bool f) { resource.full_max = f; }
|
inline bool orderedDither() const { return resource.ordered_dither; }
|
||||||
inline void saveFocusNew(Bool f) { resource.focus_new = f; }
|
|
||||||
inline void saveFocusLast(Bool f) { resource.focus_last = f; }
|
inline bool opaqueMove() const { return resource.opaque_move; }
|
||||||
inline void iconUpdate() { iconmenu->update(); }
|
void setOpaqueMove(bool o);
|
||||||
|
|
||||||
|
inline bool fullMax() const { return resource.full_max; }
|
||||||
|
void setFullMax(bool f);
|
||||||
|
|
||||||
|
inline bool focusNew() const { return resource.focus_new; }
|
||||||
|
void setFocusNew(bool f);
|
||||||
|
|
||||||
|
inline bool focusLast() const { return resource.focus_last; }
|
||||||
|
void setFocusLast(bool f);
|
||||||
|
|
||||||
|
inline int getWindowZones() const { return resource.zones; }
|
||||||
|
void setWindowZones(int z);
|
||||||
|
|
||||||
|
inline int workspaceCount() const { return resource.workspaces; }
|
||||||
|
void setWorkspaceCount(int w);
|
||||||
|
|
||||||
|
inline int placementPolicy() const { return resource.placement_policy; }
|
||||||
|
void setPlacementPolicy(int p);
|
||||||
|
|
||||||
|
inline int edgeSnapThreshold() const { return resource.edge_snap_threshold; }
|
||||||
|
void setEdgeSnapThreshold(int t);
|
||||||
|
|
||||||
|
inline int rowPlacementDirection() const { return resource.row_direction; }
|
||||||
|
void setRowPlacementDirection(int d);
|
||||||
|
|
||||||
|
inline int colPlacementDirection() const { return resource.col_direction; }
|
||||||
|
void setColPlacementDirection(int d);
|
||||||
|
|
||||||
|
inline char *rootCommand() const { return resource.root_command; }
|
||||||
|
inline void setRootCommand(const char *cmd);
|
||||||
|
|
||||||
#ifdef HAVE_STRFTIME
|
#ifdef HAVE_STRFTIME
|
||||||
inline char *getStrftimeFormat() { return resource.strftime_format; }
|
inline char *strftimeFormat() { return resource.strftime_format; }
|
||||||
void saveStrftimeFormat(const char *);
|
void setStrftimeFormat(const char *);
|
||||||
#else // !HAVE_STRFTIME
|
#else // !HAVE_STRFTIME
|
||||||
inline int getDateFormat() { return resource.date_format; }
|
inline int dateFormat() { return resource.date_format; }
|
||||||
inline void saveDateFormat(int f) { resource.date_format = f; }
|
void setDateFormat(int f);
|
||||||
inline Bool isClock24Hour() { return resource.clock24hour; }
|
inline bool clock24Hour() { return resource.clock24hour; }
|
||||||
inline void saveClock24Hour(Bool c) { resource.clock24hour = c; }
|
void setClock24Hour(Bool c);
|
||||||
#endif // HAVE_STRFTIME
|
#endif // HAVE_STRFTIME
|
||||||
|
|
||||||
inline bool hideToolbar() const { return resource.hide_toolbar; }
|
inline bool hideToolbar() const { return resource.hide_toolbar; }
|
||||||
|
@ -286,6 +280,7 @@ public:
|
||||||
|
|
||||||
void removeWorkspaceNames();
|
void removeWorkspaceNames();
|
||||||
void addWorkspaceName(const char *);
|
void addWorkspaceName(const char *);
|
||||||
|
void saveWorkspaceNames();
|
||||||
void addNetizen(Netizen *);
|
void addNetizen(Netizen *);
|
||||||
void removeNetizen(Window);
|
void removeNetizen(Window);
|
||||||
void addIcon(OpenboxWindow *);
|
void addIcon(OpenboxWindow *);
|
||||||
|
@ -299,6 +294,7 @@ public:
|
||||||
void raiseFocus();
|
void raiseFocus();
|
||||||
void reconfigure();
|
void reconfigure();
|
||||||
void load();
|
void load();
|
||||||
|
void save();
|
||||||
void rereadMenu();
|
void rereadMenu();
|
||||||
void shutdown();
|
void shutdown();
|
||||||
void showPosition(int, int);
|
void showPosition(int, int);
|
||||||
|
|
|
@ -256,6 +256,13 @@ void Slit::setDirection(int d) {
|
||||||
m_direction == Horizontal ? "Horizontal" : "Vertical");
|
m_direction == Horizontal ? "Horizontal" : "Vertical");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Slit::save() {
|
||||||
|
setOnTop(m_ontop);
|
||||||
|
setAutoHide(m_autohide);
|
||||||
|
setPlacement(m_placement);
|
||||||
|
setDirection(m_direction);
|
||||||
|
}
|
||||||
|
|
||||||
void Slit::load() {
|
void Slit::load() {
|
||||||
std::ostrstream rscreen, rname, rclass;
|
std::ostrstream rscreen, rname, rclass;
|
||||||
std::string s;
|
std::string s;
|
||||||
|
|
|
@ -137,6 +137,7 @@ public:
|
||||||
void removeClient(Window, Bool = True);
|
void removeClient(Window, Bool = True);
|
||||||
void reconfigure();
|
void reconfigure();
|
||||||
void load();
|
void load();
|
||||||
|
void save();
|
||||||
void reposition();
|
void reposition();
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
|
||||||
|
|
|
@ -257,6 +257,13 @@ void Toolbar::setPlacement(int p) {
|
||||||
config.setValue(s.str(), placement);
|
config.setValue(s.str(), placement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Toolbar::save() {
|
||||||
|
setOnTop(m_ontop);
|
||||||
|
setAutoHide(m_autohide);
|
||||||
|
setWidthPercent(m_width_percent);
|
||||||
|
setPlacement(m_placement);
|
||||||
|
}
|
||||||
|
|
||||||
void Toolbar::load() {
|
void Toolbar::load() {
|
||||||
std::ostrstream rscreen, rname, rclass;
|
std::ostrstream rscreen, rname, rclass;
|
||||||
std::string s;
|
std::string s;
|
||||||
|
@ -379,7 +386,7 @@ void Toolbar::reconfigure() {
|
||||||
tt = localtime(&ttmp);
|
tt = localtime(&ttmp);
|
||||||
if (tt) {
|
if (tt) {
|
||||||
char t[1025], *time_string = (char *) 0;
|
char t[1025], *time_string = (char *) 0;
|
||||||
int len = strftime(t, 1024, screen.getStrftimeFormat(), tt);
|
int len = strftime(t, 1024, screen.strftimeFormat(), tt);
|
||||||
t[len++-1] = ' '; // add a space to the string for padding
|
t[len++-1] = ' '; // add a space to the string for padding
|
||||||
t[len] = '\0';
|
t[len] = '\0';
|
||||||
|
|
||||||
|
@ -616,7 +623,7 @@ void Toolbar::checkClock(Bool redraw, Bool date) {
|
||||||
if (redraw) {
|
if (redraw) {
|
||||||
#ifdef HAVE_STRFTIME
|
#ifdef HAVE_STRFTIME
|
||||||
char t[1024];
|
char t[1024];
|
||||||
if (! strftime(t, 1024, screen.getStrftimeFormat(), tt))
|
if (! strftime(t, 1024, screen.strftimeFormat(), tt))
|
||||||
return;
|
return;
|
||||||
#else // !HAVE_STRFTIME
|
#else // !HAVE_STRFTIME
|
||||||
char t[9];
|
char t[9];
|
||||||
|
@ -950,7 +957,7 @@ void Toolbar::edit() {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
XSetInputFocus(display, frame.workspace_label,
|
XSetInputFocus(display, frame.workspace_label,
|
||||||
((screen.isSloppyFocus()) ? RevertToPointerRoot :
|
((screen.sloppyFocus()) ? RevertToPointerRoot :
|
||||||
RevertToParent),
|
RevertToParent),
|
||||||
CurrentTime);
|
CurrentTime);
|
||||||
XClearWindow(display, frame.workspace_label);
|
XClearWindow(display, frame.workspace_label);
|
||||||
|
|
|
@ -136,6 +136,7 @@ public:
|
||||||
void edit();
|
void edit();
|
||||||
void reconfigure();
|
void reconfigure();
|
||||||
void load();
|
void load();
|
||||||
|
void save();
|
||||||
void mapToolbar();
|
void mapToolbar();
|
||||||
void unMapToolbar();
|
void unMapToolbar();
|
||||||
#ifdef HAVE_STRFTIME
|
#ifdef HAVE_STRFTIME
|
||||||
|
|
|
@ -259,7 +259,7 @@ OpenboxWindow::OpenboxWindow(Openbox &o, Window w, BScreen *s) : openbox(o) {
|
||||||
|
|
||||||
associateClientWindow();
|
associateClientWindow();
|
||||||
|
|
||||||
if (! screen->isSloppyFocus())
|
if (! screen->sloppyFocus())
|
||||||
openbox.grabButton(Button1, 0, frame.plate, True, ButtonPressMask,
|
openbox.grabButton(Button1, 0, frame.plate, True, ButtonPressMask,
|
||||||
GrabModeSync, GrabModeSync, None, None);
|
GrabModeSync, GrabModeSync, None, None);
|
||||||
|
|
||||||
|
@ -847,7 +847,7 @@ void OpenboxWindow::reconfigure(void) {
|
||||||
|
|
||||||
configure(frame.x, frame.y, frame.width, frame.height);
|
configure(frame.x, frame.y, frame.width, frame.height);
|
||||||
|
|
||||||
if (! screen->isSloppyFocus())
|
if (! screen->sloppyFocus())
|
||||||
openbox.grabButton(Button1, 0, frame.plate, True, ButtonPressMask,
|
openbox.grabButton(Button1, 0, frame.plate, True, ButtonPressMask,
|
||||||
GrabModeSync, GrabModeSync, None, None);
|
GrabModeSync, GrabModeSync, None, None);
|
||||||
else
|
else
|
||||||
|
@ -1407,7 +1407,7 @@ Bool OpenboxWindow::setInputFocus(void) {
|
||||||
XSendEvent(display, client.window, False, NoEventMask, &ce);
|
XSendEvent(display, client.window, False, NoEventMask, &ce);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (screen->isSloppyFocus() && screen->doAutoRaise())
|
if (screen->sloppyFocus() && screen->autoRaise())
|
||||||
timer->start();
|
timer->start();
|
||||||
|
|
||||||
ret = True;
|
ret = True;
|
||||||
|
@ -1465,7 +1465,7 @@ void OpenboxWindow::deiconify(Bool reassoc, Bool raise) {
|
||||||
XMapSubwindows(display, frame.window);
|
XMapSubwindows(display, frame.window);
|
||||||
XMapWindow(display, frame.window);
|
XMapWindow(display, frame.window);
|
||||||
|
|
||||||
if (flags.iconic && screen->doFocusNew()) setInputFocus();
|
if (flags.iconic && screen->focusNew()) setInputFocus();
|
||||||
|
|
||||||
flags.visible = True;
|
flags.visible = True;
|
||||||
flags.iconic = False;
|
flags.iconic = False;
|
||||||
|
@ -1553,7 +1553,7 @@ void OpenboxWindow::maximize(unsigned int button) {
|
||||||
dh -= client.base_height;
|
dh -= client.base_height;
|
||||||
dh -= frame.y_border;
|
dh -= frame.y_border;
|
||||||
|
|
||||||
if (! screen->doFullMax())
|
if (! screen->fullMax())
|
||||||
dh -= screen->getToolbar()->getExposedHeight() + frame.border_w;
|
dh -= screen->getToolbar()->getExposedHeight() + frame.border_w;
|
||||||
|
|
||||||
if (dw < client.min_width) dw = client.min_width;
|
if (dw < client.min_width) dw = client.min_width;
|
||||||
|
@ -1573,7 +1573,7 @@ void OpenboxWindow::maximize(unsigned int button) {
|
||||||
|
|
||||||
dx += ((screen->size().w() - dw) / 2) - frame.border_w;
|
dx += ((screen->size().w() - dw) / 2) - frame.border_w;
|
||||||
|
|
||||||
if (screen->doFullMax()) {
|
if (screen->fullMax()) {
|
||||||
dy += ((screen->size().h() - dh) / 2) - frame.border_w;
|
dy += ((screen->size().h() - dh) / 2) - frame.border_w;
|
||||||
} else {
|
} else {
|
||||||
dy += (((screen->size().h() - screen->getToolbar()->getExposedHeight())
|
dy += (((screen->size().h() - screen->getToolbar()->getExposedHeight())
|
||||||
|
@ -1740,7 +1740,7 @@ void OpenboxWindow::setFocusFlag(Bool focus) {
|
||||||
XSetWindowBorder(display, frame.plate, frame.uborder_pixel);
|
XSetWindowBorder(display, frame.plate, frame.uborder_pixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (screen->isSloppyFocus() && screen->doAutoRaise() && timer->isTiming())
|
if (screen->sloppyFocus() && screen->autoRaise() && timer->isTiming())
|
||||||
timer->stop();
|
timer->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2258,7 +2258,7 @@ void OpenboxWindow::mapNotifyEvent(XMapEvent *ne) {
|
||||||
|
|
||||||
redrawAllButtons();
|
redrawAllButtons();
|
||||||
|
|
||||||
if (flags.transient || screen->doFocusNew())
|
if (flags.transient || screen->focusNew())
|
||||||
setInputFocus();
|
setInputFocus();
|
||||||
else
|
else
|
||||||
setFocusFlag(False);
|
setFocusFlag(False);
|
||||||
|
@ -2641,7 +2641,7 @@ void OpenboxWindow::buttonPressEvent(XButtonEvent *be) {
|
||||||
shade();
|
shade();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! (flags.focused || screen->isSloppyFocus()) ) {
|
if (! (flags.focused || screen->sloppyFocus()) ) {
|
||||||
setInputFocus(); // any click focus' the window in 'click to focus'
|
setInputFocus(); // any click focus' the window in 'click to focus'
|
||||||
}
|
}
|
||||||
if (stack_change < 0) {
|
if (stack_change < 0) {
|
||||||
|
@ -2722,7 +2722,7 @@ void OpenboxWindow::buttonReleaseEvent(XButtonEvent *re) {
|
||||||
flags.moving = False;
|
flags.moving = False;
|
||||||
|
|
||||||
openbox.maskWindowEvents(0, (OpenboxWindow *) 0);
|
openbox.maskWindowEvents(0, (OpenboxWindow *) 0);
|
||||||
if (!screen->doOpaqueMove()) {
|
if (!screen->opaqueMove()) {
|
||||||
XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
|
XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
|
||||||
frame.move_x, frame.move_y, frame.resize_w - 1,
|
frame.move_x, frame.move_y, frame.resize_w - 1,
|
||||||
frame.resize_h - 1);
|
frame.resize_h - 1);
|
||||||
|
@ -2781,7 +2781,7 @@ void OpenboxWindow::motionNotifyEvent(XMotionEvent *me) {
|
||||||
|
|
||||||
openbox.maskWindowEvents(client.window, this);
|
openbox.maskWindowEvents(client.window, this);
|
||||||
|
|
||||||
if (! screen->doOpaqueMove()) {
|
if (! screen->opaqueMove()) {
|
||||||
openbox.grab();
|
openbox.grab();
|
||||||
|
|
||||||
frame.move_x = frame.x;
|
frame.move_x = frame.x;
|
||||||
|
@ -2802,7 +2802,7 @@ void OpenboxWindow::motionNotifyEvent(XMotionEvent *me) {
|
||||||
dx -= frame.border_w;
|
dx -= frame.border_w;
|
||||||
dy -= frame.border_w;
|
dy -= frame.border_w;
|
||||||
|
|
||||||
int snap_distance = screen->getEdgeSnapThreshold();
|
int snap_distance = screen->edgeSnapThreshold();
|
||||||
// width/height of the snapping window
|
// width/height of the snapping window
|
||||||
unsigned int snap_w = frame.width + (frame.border_w * 2);
|
unsigned int snap_w = frame.width + (frame.border_w * 2);
|
||||||
unsigned int snap_h = size().h() + (frame.border_w * 2);
|
unsigned int snap_h = size().h() + (frame.border_w * 2);
|
||||||
|
@ -2843,7 +2843,7 @@ void OpenboxWindow::motionNotifyEvent(XMotionEvent *me) {
|
||||||
dy = dbby - snap_h;
|
dy = dbby - snap_h;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (screen->doOpaqueMove()) {
|
if (screen->opaqueMove()) {
|
||||||
configure(dx, dy, frame.width, frame.height);
|
configure(dx, dy, frame.width, frame.height);
|
||||||
} else {
|
} else {
|
||||||
XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
|
XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
|
||||||
|
|
|
@ -120,7 +120,7 @@ const int Workspace::removeWindow(OpenboxWindow *w) {
|
||||||
if (w->isTransient() && w->getTransientFor() &&
|
if (w->isTransient() && w->getTransientFor() &&
|
||||||
w->getTransientFor()->isVisible()) {
|
w->getTransientFor()->isVisible()) {
|
||||||
w->getTransientFor()->setInputFocus();
|
w->getTransientFor()->setInputFocus();
|
||||||
} else if (screen.isSloppyFocus()) {
|
} else if (screen.sloppyFocus()) {
|
||||||
screen.getOpenbox().setFocusedWindow((OpenboxWindow *) 0);
|
screen.getOpenbox().setFocusedWindow((OpenboxWindow *) 0);
|
||||||
} else {
|
} else {
|
||||||
OpenboxWindow *top = stackingList->first();
|
OpenboxWindow *top = stackingList->first();
|
||||||
|
@ -321,6 +321,7 @@ void Workspace::setName(char *new_name) {
|
||||||
|
|
||||||
clientmenu->setLabel(name);
|
clientmenu->setLabel(name);
|
||||||
clientmenu->update();
|
clientmenu->update();
|
||||||
|
screen.saveWorkspaceNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -406,22 +407,22 @@ inline Point *Workspace::rowSmartPlacement(const Size &win_size,
|
||||||
int test_x, test_y, place_x = 0, place_y = 0;
|
int test_x, test_y, place_x = 0, place_y = 0;
|
||||||
int start_pos = 0;
|
int start_pos = 0;
|
||||||
int change_y =
|
int change_y =
|
||||||
((screen.getColPlacementDirection() == BScreen::TopBottom) ? 1 : -1);
|
((screen.colPlacementDirection() == BScreen::TopBottom) ? 1 : -1);
|
||||||
int change_x =
|
int change_x =
|
||||||
((screen.getRowPlacementDirection() == BScreen::LeftRight) ? 1 : -1);
|
((screen.rowPlacementDirection() == BScreen::LeftRight) ? 1 : -1);
|
||||||
int delta_x = 8, delta_y = 8;
|
int delta_x = 8, delta_y = 8;
|
||||||
LinkedListIterator<OpenboxWindow> it(windowList);
|
LinkedListIterator<OpenboxWindow> it(windowList);
|
||||||
|
|
||||||
test_y = (screen.getColPlacementDirection() == BScreen::TopBottom) ?
|
test_y = (screen.colPlacementDirection() == BScreen::TopBottom) ?
|
||||||
start_pos : screen.size().h() - win_size.h() - start_pos;
|
start_pos : screen.size().h() - win_size.h() - start_pos;
|
||||||
|
|
||||||
while(!placed &&
|
while(!placed &&
|
||||||
((screen.getColPlacementDirection() == BScreen::BottomTop) ?
|
((screen.colPlacementDirection() == BScreen::BottomTop) ?
|
||||||
test_y > 0 : test_y + win_size.h() < (signed) space.h())) {
|
test_y > 0 : test_y + win_size.h() < (signed) space.h())) {
|
||||||
test_x = (screen.getRowPlacementDirection() == BScreen::LeftRight) ?
|
test_x = (screen.rowPlacementDirection() == BScreen::LeftRight) ?
|
||||||
start_pos : space.w() - win_size.w() - start_pos;
|
start_pos : space.w() - win_size.w() - start_pos;
|
||||||
while (!placed &&
|
while (!placed &&
|
||||||
((screen.getRowPlacementDirection() == BScreen::RightLeft) ?
|
((screen.rowPlacementDirection() == BScreen::RightLeft) ?
|
||||||
test_x > 0 : test_x + win_size.w() < (signed) space.w())) {
|
test_x > 0 : test_x + win_size.w() < (signed) space.w())) {
|
||||||
placed = true;
|
placed = true;
|
||||||
|
|
||||||
|
@ -467,23 +468,23 @@ inline Point * Workspace::colSmartPlacement(const Size &win_size,
|
||||||
int test_x, test_y;
|
int test_x, test_y;
|
||||||
int start_pos = 0;
|
int start_pos = 0;
|
||||||
int change_y =
|
int change_y =
|
||||||
((screen.getColPlacementDirection() == BScreen::TopBottom) ? 1 : -1);
|
((screen.colPlacementDirection() == BScreen::TopBottom) ? 1 : -1);
|
||||||
int change_x =
|
int change_x =
|
||||||
((screen.getRowPlacementDirection() == BScreen::LeftRight) ? 1 : -1);
|
((screen.rowPlacementDirection() == BScreen::LeftRight) ? 1 : -1);
|
||||||
int delta_x = 8, delta_y = 8;
|
int delta_x = 8, delta_y = 8;
|
||||||
LinkedListIterator<OpenboxWindow> it(windowList);
|
LinkedListIterator<OpenboxWindow> it(windowList);
|
||||||
|
|
||||||
test_x = (screen.getRowPlacementDirection() == BScreen::LeftRight) ?
|
test_x = (screen.rowPlacementDirection() == BScreen::LeftRight) ?
|
||||||
start_pos : screen.size().w() - win_size.w() - start_pos;
|
start_pos : screen.size().w() - win_size.w() - start_pos;
|
||||||
|
|
||||||
while(!placed &&
|
while(!placed &&
|
||||||
((screen.getRowPlacementDirection() == BScreen::RightLeft) ?
|
((screen.rowPlacementDirection() == BScreen::RightLeft) ?
|
||||||
test_x > 0 : test_x + win_size.w() < (signed) space.w())) {
|
test_x > 0 : test_x + win_size.w() < (signed) space.w())) {
|
||||||
test_y = (screen.getColPlacementDirection() == BScreen::TopBottom) ?
|
test_y = (screen.colPlacementDirection() == BScreen::TopBottom) ?
|
||||||
start_pos : screen.size().h() - win_size.h() - start_pos;
|
start_pos : screen.size().h() - win_size.h() - start_pos;
|
||||||
|
|
||||||
while(!placed &&
|
while(!placed &&
|
||||||
((screen.getColPlacementDirection() == BScreen::BottomTop) ?
|
((screen.colPlacementDirection() == BScreen::BottomTop) ?
|
||||||
test_y > 0 : test_y + win_size.h() < (signed) space.h())){
|
test_y > 0 : test_y + win_size.h() < (signed) space.h())){
|
||||||
|
|
||||||
placed = true;
|
placed = true;
|
||||||
|
@ -555,9 +556,9 @@ void Workspace::placeWindow(OpenboxWindow *win) {
|
||||||
(screen.getBorderWidth() * 4),
|
(screen.getBorderWidth() * 4),
|
||||||
start_pos = 0,
|
start_pos = 0,
|
||||||
change_y =
|
change_y =
|
||||||
((screen.getColPlacementDirection() == BScreen::TopBottom) ? 1 : -1),
|
((screen.colPlacementDirection() == BScreen::TopBottom) ? 1 : -1),
|
||||||
change_x =
|
change_x =
|
||||||
((screen.getRowPlacementDirection() == BScreen::LeftRight) ? 1 : -1),
|
((screen.rowPlacementDirection() == BScreen::LeftRight) ? 1 : -1),
|
||||||
delta_x = 8, delta_y = 8;
|
delta_x = 8, delta_y = 8;
|
||||||
|
|
||||||
LinkedListIterator<OpenboxWindow> it(windowList);
|
LinkedListIterator<OpenboxWindow> it(windowList);
|
||||||
|
@ -570,7 +571,7 @@ void Workspace::placeWindow(OpenboxWindow *win) {
|
||||||
win->size().h()+screen.getBorderWidth() * 4);
|
win->size().h()+screen.getBorderWidth() * 4);
|
||||||
Point *place = NULL;
|
Point *place = NULL;
|
||||||
|
|
||||||
switch (screen.getPlacementPolicy()) {
|
switch (screen.placementPolicy()) {
|
||||||
case BScreen::BestFitPlacement:
|
case BScreen::BestFitPlacement:
|
||||||
place = bestFitPlacement(window_size, space);
|
place = bestFitPlacement(window_size, space);
|
||||||
break;
|
break;
|
||||||
|
|
342
src/openbox.cc
342
src/openbox.cc
|
@ -201,7 +201,7 @@ Openbox::Openbox(int m_argc, char **m_argv, char *dpy_name, char *rc)
|
||||||
|
|
||||||
menuTimestamps = new LinkedList<MenuTimestamp>;
|
menuTimestamps = new LinkedList<MenuTimestamp>;
|
||||||
|
|
||||||
load_rc();
|
load();
|
||||||
|
|
||||||
#ifdef HAVE_GETPID
|
#ifdef HAVE_GETPID
|
||||||
openbox_pid = XInternAtom(getXDisplay(), "_BLACKBOX_PID", False);
|
openbox_pid = XInternAtom(getXDisplay(), "_BLACKBOX_PID", False);
|
||||||
|
@ -226,6 +226,9 @@ Openbox::Openbox(int m_argc, char **m_argv, char *dpy_name, char *rc)
|
||||||
::exit(3);
|
::exit(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// save current settings and default values
|
||||||
|
save();
|
||||||
|
|
||||||
XSynchronize(getXDisplay(), False);
|
XSynchronize(getXDisplay(), False);
|
||||||
XSync(getXDisplay(), False);
|
XSync(getXDisplay(), False);
|
||||||
|
|
||||||
|
@ -239,7 +242,7 @@ Openbox::Openbox(int m_argc, char **m_argv, char *dpy_name, char *rc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Openbox::~Openbox(void) {
|
Openbox::~Openbox() {
|
||||||
while (screenList->count())
|
while (screenList->count())
|
||||||
delete screenList->remove(0);
|
delete screenList->remove(0);
|
||||||
|
|
||||||
|
@ -583,7 +586,7 @@ void Openbox::process_event(XEvent *e) {
|
||||||
(screen = searchScreen(e->xcrossing.window))) {
|
(screen = searchScreen(e->xcrossing.window))) {
|
||||||
screen->getImageControl()->installRootColormap();
|
screen->getImageControl()->installRootColormap();
|
||||||
} else if ((win = searchWindow(e->xcrossing.window))) {
|
} else if ((win = searchWindow(e->xcrossing.window))) {
|
||||||
if (win->getScreen()->isSloppyFocus() &&
|
if (win->getScreen()->sloppyFocus() &&
|
||||||
(! win->isFocused()) && (! no_focus)) {
|
(! win->isFocused()) && (! no_focus)) {
|
||||||
grab();
|
grab();
|
||||||
|
|
||||||
|
@ -748,11 +751,8 @@ void Openbox::process_event(XEvent *e) {
|
||||||
Bool Openbox::handleSignal(int sig) {
|
Bool Openbox::handleSignal(int sig) {
|
||||||
switch (sig) {
|
switch (sig) {
|
||||||
case SIGHUP:
|
case SIGHUP:
|
||||||
reconfigure();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SIGUSR1:
|
case SIGUSR1:
|
||||||
reload_rc();
|
reconfigure();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIGUSR2:
|
case SIGUSR2:
|
||||||
|
@ -957,7 +957,7 @@ void Openbox::restart(const char *prog) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Openbox::shutdown(void) {
|
void Openbox::shutdown() {
|
||||||
BaseDisplay::shutdown();
|
BaseDisplay::shutdown();
|
||||||
|
|
||||||
XSetInputFocus(getXDisplay(), PointerRoot, None, CurrentTime);
|
XSetInputFocus(getXDisplay(), PointerRoot, None, CurrentTime);
|
||||||
|
@ -967,14 +967,15 @@ void Openbox::shutdown(void) {
|
||||||
s->shutdown();
|
s->shutdown();
|
||||||
|
|
||||||
XSync(getXDisplay(), False);
|
XSync(getXDisplay(), False);
|
||||||
|
|
||||||
save_rc();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Openbox::save_rc(void) {
|
void Openbox::save() {
|
||||||
config.setAutoSave(false);
|
config.setAutoSave(false);
|
||||||
|
|
||||||
|
// save all values as they are so that the defaults will be written to the rc
|
||||||
|
// file
|
||||||
|
|
||||||
config.setValue("session.menuFile", getMenuFilename());
|
config.setValue("session.menuFile", getMenuFilename());
|
||||||
config.setValue("session.colorsPerChannel",
|
config.setValue("session.colorsPerChannel",
|
||||||
resource.colors_per_channel);
|
resource.colors_per_channel);
|
||||||
|
@ -985,122 +986,20 @@ void Openbox::save_rc(void) {
|
||||||
(resource.auto_raise_delay.tv_usec / 1000)));
|
(resource.auto_raise_delay.tv_usec / 1000)));
|
||||||
config.setValue("session.cacheLife", (long)resource.cache_life / 60000);
|
config.setValue("session.cacheLife", (long)resource.cache_life / 60000);
|
||||||
config.setValue("session.cacheMax", (long)resource.cache_max);
|
config.setValue("session.cacheMax", (long)resource.cache_max);
|
||||||
|
config.setValue("session.styleFile", resource.style_file);
|
||||||
|
|
||||||
LinkedListIterator<BScreen> it(screenList);
|
LinkedListIterator<BScreen> it(screenList);
|
||||||
for (BScreen *screen = it.current(); screen; it++, screen = it.current()) {
|
for (BScreen *s = it.current(); s != NULL; it++, s = it.current()) {
|
||||||
// ScreenList::iterator it = screenList.begin();
|
s->save();
|
||||||
// for (; it != screenList.end(); ++it) {
|
s->getToolbar()->save();
|
||||||
// BScreen *screen = *it;
|
s->getSlit()->save();
|
||||||
char rc_string[1024];
|
|
||||||
const int screen_number = screen->getScreenNumber();
|
|
||||||
|
|
||||||
config.setValue("session.opaqueMove",
|
|
||||||
(screen->doOpaqueMove()) ? "True" : "False");
|
|
||||||
config.setValue("session.imageDither",
|
|
||||||
(screen->getImageControl()->doDither()) ? "True" : "False");
|
|
||||||
|
|
||||||
sprintf(rc_string, "session.screen%d.fullMaximization", screen_number);
|
|
||||||
config.setValue(rc_string, screen->doFullMax() ? "True" : "False");
|
|
||||||
|
|
||||||
sprintf(rc_string, "session.screen%d.focusNewWindows", screen_number);
|
|
||||||
config.setValue(rc_string, screen->doFocusNew() ? "True" : "False");
|
|
||||||
|
|
||||||
sprintf(rc_string, "session.screen%d.focusLastWindow", screen_number);
|
|
||||||
config.setValue(rc_string, screen->doFocusLast() ? "True" : "False");
|
|
||||||
|
|
||||||
sprintf(rc_string, "session.screen%d.rowPlacementDirection", screen_number);
|
|
||||||
config.setValue(rc_string,
|
|
||||||
screen->getRowPlacementDirection() == BScreen::LeftRight ?
|
|
||||||
"LeftToRight" : "RightToLeft");
|
|
||||||
|
|
||||||
sprintf(rc_string, "session.screen%d.colPlacementDirection", screen_number);
|
|
||||||
config.setValue(rc_string,
|
|
||||||
screen->getColPlacementDirection() == BScreen::TopBottom ?
|
|
||||||
"TopToBottom" : "BottomToTop");
|
|
||||||
|
|
||||||
const char *placement;
|
|
||||||
switch (screen->getPlacementPolicy()) {
|
|
||||||
case BScreen::CascadePlacement: placement = "CascadePlacement"; break;
|
|
||||||
case BScreen::BestFitPlacement: placement = "BestFitPlacement"; break;
|
|
||||||
case BScreen::ColSmartPlacement: placement = "ColSmartPlacement"; break;
|
|
||||||
default:
|
|
||||||
case BScreen::RowSmartPlacement: placement = "RowSmartPlacement"; break;
|
|
||||||
}
|
|
||||||
sprintf(rc_string, "session.screen%d.windowPlacement", screen_number);
|
|
||||||
config.setValue(rc_string, placement);
|
|
||||||
|
|
||||||
sprintf(rc_string, "session.screen%d.focusModel", screen_number);
|
|
||||||
config.setValue(rc_string,
|
|
||||||
(screen->isSloppyFocus() ?
|
|
||||||
(screen->doAutoRaise() ? "AutoRaiseSloppyFocus" :
|
|
||||||
"SloppyFocus") : "ClickToFocus"));
|
|
||||||
|
|
||||||
sprintf(rc_string, "session.screen%d.workspaces", screen_number);
|
|
||||||
config.setValue(rc_string, screen->getWorkspaceCount());
|
|
||||||
|
|
||||||
#ifdef HAVE_STRFTIME
|
|
||||||
sprintf(rc_string, "session.screen%d.strftimeFormat", screen_number);
|
|
||||||
config.setValue(rc_string, screen->getStrftimeFormat());
|
|
||||||
#else // !HAVE_STRFTIME
|
|
||||||
sprintf(rc_string, "session.screen%d.dateFormat", screen_number);
|
|
||||||
config.setValue(rc_string, screen->getDateFormat() == B_EuropeanDate ?
|
|
||||||
"European" : "American");
|
|
||||||
|
|
||||||
sprintf(rc_string, "session.screen%d.clockFormat", screen_number);
|
|
||||||
config.setValue(rc_string, screen->isClock24Hour() ? 24 : 12);
|
|
||||||
#endif // HAVE_STRFTIME
|
|
||||||
|
|
||||||
sprintf(rc_string, "session.screen%d.edgeSnapThreshold", screen_number);
|
|
||||||
config.setValue(rc_string, screen->getEdgeSnapThreshold());
|
|
||||||
|
|
||||||
// write out the user's workspace names
|
|
||||||
int i, len = 0;
|
|
||||||
for (i = 0; i < screen->getWorkspaceCount(); i++)
|
|
||||||
len += strlen((screen->getWorkspace(i)->getName()) ?
|
|
||||||
screen->getWorkspace(i)->getName() : "Null") + 1;
|
|
||||||
|
|
||||||
char *resource_string = new char[len + 1024],
|
|
||||||
*save_string = new char[len], *save_string_pos = save_string,
|
|
||||||
*name_string_pos;
|
|
||||||
if (save_string) {
|
|
||||||
for (i = 0; i < screen->getWorkspaceCount(); i++) {
|
|
||||||
len = strlen((screen->getWorkspace(i)->getName()) ?
|
|
||||||
screen->getWorkspace(i)->getName() : "Null") + 1;
|
|
||||||
name_string_pos =
|
|
||||||
(char *) ((screen->getWorkspace(i)->getName()) ?
|
|
||||||
screen->getWorkspace(i)->getName() : "Null");
|
|
||||||
|
|
||||||
while (--len) *(save_string_pos++) = *(name_string_pos++);
|
|
||||||
*(save_string_pos++) = ',';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*(--save_string_pos) = '\0';
|
|
||||||
|
|
||||||
sprintf(resource_string, "session.screen%d.workspaceNames", screen_number);
|
|
||||||
config.setValue(resource_string, save_string);
|
|
||||||
|
|
||||||
delete [] resource_string;
|
|
||||||
delete [] save_string;
|
|
||||||
/*
|
|
||||||
std::string save_string = screen->getWorkspace(0)->getName();
|
|
||||||
for (unsigned int i = 1; i < screen->getWorkspaceCount(); ++i) {
|
|
||||||
save_string += ',';
|
|
||||||
save_string += screen->getWorkspace(i)->getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
char *resource_string = new char[save_string.length() + 48];
|
|
||||||
sprintf(resource_string, "session.screen%d.workspaceNames", screen_number);
|
|
||||||
config.setValue(rc_string, save_string);
|
|
||||||
|
|
||||||
delete [] resource_string;*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
config.setAutoSave(true);
|
config.setAutoSave(true);
|
||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Openbox::load_rc(void) {
|
void Openbox::load() {
|
||||||
if (!config.load())
|
if (!config.load())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1162,207 +1061,18 @@ void Openbox::load_rc(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Openbox::load_rc(BScreen *screen) {
|
void Openbox::reconfigure() {
|
||||||
ASSERT (screen != NULL);
|
|
||||||
const int screen_number = screen->getScreenNumber();
|
|
||||||
ASSERT (screen_number >= 0);
|
|
||||||
|
|
||||||
if (!config.load())
|
|
||||||
return;
|
|
||||||
|
|
||||||
std::string s;
|
|
||||||
long l;
|
|
||||||
bool b;
|
|
||||||
char name_lookup[1024], class_lookup[1024];
|
|
||||||
|
|
||||||
sprintf(name_lookup, "session.screen%d.fullMaximization", screen_number);
|
|
||||||
sprintf(class_lookup, "Session.Screen%d.FullMaximization", screen_number);
|
|
||||||
if (config.getValue(name_lookup, class_lookup, b))
|
|
||||||
screen->saveFullMax((Bool)b);
|
|
||||||
else
|
|
||||||
screen->saveFullMax(False);
|
|
||||||
|
|
||||||
sprintf(name_lookup, "session.screen%d.focusNewWindows", screen_number);
|
|
||||||
sprintf(class_lookup, "Session.Screen%d.FocusNewWindows", screen_number);
|
|
||||||
if (config.getValue(name_lookup, class_lookup, b))
|
|
||||||
screen->saveFocusNew((Bool)b);
|
|
||||||
else
|
|
||||||
screen->saveFocusNew(False);
|
|
||||||
|
|
||||||
sprintf(name_lookup, "session.screen%d.focusLastWindow", screen_number);
|
|
||||||
sprintf(class_lookup, "Session.Screen%d.focusLastWindow", screen_number);
|
|
||||||
if (config.getValue(name_lookup, class_lookup, b))
|
|
||||||
screen->saveFocusLast((Bool)b);
|
|
||||||
else
|
|
||||||
screen->saveFocusLast(False);
|
|
||||||
|
|
||||||
sprintf(name_lookup, "session.screen%d.rowPlacementDirection",
|
|
||||||
screen_number);
|
|
||||||
sprintf(class_lookup, "Session.Screen%d.RowPlacementDirection",
|
|
||||||
screen_number);
|
|
||||||
if (config.getValue(name_lookup, class_lookup, s)) {
|
|
||||||
if (0 == strncasecmp(s.c_str(), "righttoleft", s.length()))
|
|
||||||
screen->saveRowPlacementDirection(BScreen::RightLeft);
|
|
||||||
else
|
|
||||||
screen->saveRowPlacementDirection(BScreen::LeftRight);
|
|
||||||
} else
|
|
||||||
screen->saveRowPlacementDirection(BScreen::LeftRight);
|
|
||||||
|
|
||||||
sprintf(name_lookup, "session.screen%d.colPlacementDirection",
|
|
||||||
screen_number);
|
|
||||||
sprintf(class_lookup, "Session.Screen%d.ColPlacementDirection",
|
|
||||||
screen_number);
|
|
||||||
if (config.getValue(name_lookup, class_lookup, s)) {
|
|
||||||
if (0 == strncasecmp(s.c_str(), "bottomtotop", s.length()))
|
|
||||||
screen->saveColPlacementDirection(BScreen::BottomTop);
|
|
||||||
else
|
|
||||||
screen->saveColPlacementDirection(BScreen::TopBottom);
|
|
||||||
} else
|
|
||||||
screen->saveColPlacementDirection(BScreen::TopBottom);
|
|
||||||
|
|
||||||
sprintf(name_lookup, "session.screen%d.workspaces", screen_number);
|
|
||||||
sprintf(class_lookup, "Session.Screen%d.Workspaces", screen_number);
|
|
||||||
if (config.getValue(name_lookup, class_lookup, l))
|
|
||||||
screen->saveWorkspaces(l);
|
|
||||||
else
|
|
||||||
screen->saveWorkspaces(1);
|
|
||||||
|
|
||||||
screen->removeWorkspaceNames();
|
|
||||||
sprintf(name_lookup, "session.screen%d.workspaceNames", screen_number);
|
|
||||||
sprintf(class_lookup, "Session.Screen%d.WorkspaceNames", screen_number);
|
|
||||||
if (config.getValue(name_lookup, class_lookup, s)) {
|
|
||||||
// for (int i = 0; i < screen->getNumberOfWorkspaces(); i++) {
|
|
||||||
std::string::const_iterator it = s.begin(), end = s.end();
|
|
||||||
while(1) {
|
|
||||||
std::string::const_iterator tmp = it;// current string.begin()
|
|
||||||
it = std::find(tmp, end, ','); // look for comma between tmp and end
|
|
||||||
std::string name(tmp, it); // name = s[tmp:it]
|
|
||||||
screen->addWorkspaceName(name.c_str());
|
|
||||||
if (it == end)
|
|
||||||
break;
|
|
||||||
++it;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sprintf(name_lookup, "session.screen%d.focusModel", screen_number);
|
|
||||||
sprintf(class_lookup, "Session.Screen%d.FocusModel", screen_number);
|
|
||||||
if (config.getValue(name_lookup, class_lookup, s)) {
|
|
||||||
if (0 == strncasecmp(s.c_str(), "clicktofocus", s.length())) {
|
|
||||||
screen->saveAutoRaise(False);
|
|
||||||
screen->saveSloppyFocus(False);
|
|
||||||
} else if (0 == strncasecmp(s.c_str(), "autoraisesloppyfocus",
|
|
||||||
s.length())) {
|
|
||||||
screen->saveSloppyFocus(True);
|
|
||||||
screen->saveAutoRaise(True);
|
|
||||||
} else {
|
|
||||||
screen->saveSloppyFocus(True);
|
|
||||||
screen->saveAutoRaise(False);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
screen->saveSloppyFocus(True);
|
|
||||||
screen->saveAutoRaise(False);
|
|
||||||
}
|
|
||||||
|
|
||||||
sprintf(name_lookup, "session.screen%d.windowZones", screen_number);
|
|
||||||
sprintf(class_lookup, "Session.Screen%d.WindowZones", screen_number);
|
|
||||||
if (config.getValue(name_lookup, class_lookup, l))
|
|
||||||
screen->saveWindowZones((l == 1 || l == 2 || l == 4) ? l : 1);
|
|
||||||
else
|
|
||||||
screen->saveWindowZones(1);
|
|
||||||
|
|
||||||
sprintf(name_lookup, "session.screen%d.windowPlacement", screen_number);
|
|
||||||
sprintf(class_lookup, "Session.Screen%d.WindowPlacement", screen_number);
|
|
||||||
if (config.getValue(name_lookup, class_lookup, s)) {
|
|
||||||
if (0 == strncasecmp(s.c_str(), "RowSmartPlacement", s.length()))
|
|
||||||
screen->savePlacementPolicy(BScreen::RowSmartPlacement);
|
|
||||||
else if (0 == strncasecmp(s.c_str(), "ColSmartPlacement", s.length()))
|
|
||||||
screen->savePlacementPolicy(BScreen::ColSmartPlacement);
|
|
||||||
else if (0 == strncasecmp(s.c_str(), "BestFitPlacement", s.length()))
|
|
||||||
screen->savePlacementPolicy(BScreen::BestFitPlacement);
|
|
||||||
else
|
|
||||||
screen->savePlacementPolicy(BScreen::CascadePlacement);
|
|
||||||
} else
|
|
||||||
screen->savePlacementPolicy(BScreen::RowSmartPlacement);
|
|
||||||
|
|
||||||
#ifdef SLIT
|
|
||||||
#endif // SLIT
|
|
||||||
|
|
||||||
#ifdef HAVE_STRFTIME
|
|
||||||
sprintf(name_lookup, "session.screen%d.strftimeFormat", screen_number);
|
|
||||||
sprintf(class_lookup, "Session.Screen%d.StrftimeFormat", screen_number);
|
|
||||||
if (config.getValue(name_lookup, class_lookup, s))
|
|
||||||
screen->saveStrftimeFormat(s.c_str());
|
|
||||||
else
|
|
||||||
screen->saveStrftimeFormat("%I:%M %p");
|
|
||||||
|
|
||||||
#else // HAVE_STRFTIME
|
|
||||||
sprintf(name_lookup, "session.screen%d.dateFormat", screen_number);
|
|
||||||
sprintf(class_lookup, "Session.Screen%d.DateFormat", screen_number);
|
|
||||||
if (config.getValue(name_lookup, class_lookup, s)) {
|
|
||||||
if (strncasecmp(s.c_str(), "european", s.length()))
|
|
||||||
screen->saveDateFormat(B_AmericanDate);
|
|
||||||
else
|
|
||||||
screen->saveDateFormat(B_EuropeanDate);
|
|
||||||
} else
|
|
||||||
screen->saveDateFormat(B_AmericanDate);
|
|
||||||
|
|
||||||
sprintf(name_lookup, "session.screen%d.clockFormat", screen_number);
|
|
||||||
sprintf(class_lookup, "Session.Screen%d.ClockFormat", screen_number);
|
|
||||||
if (config.getValue(name_lookup, class_lookup, l)) {
|
|
||||||
if (clock == 24)
|
|
||||||
screen->saveClock24Hour(True);
|
|
||||||
else
|
|
||||||
screen->saveClock24Hour(False);
|
|
||||||
} else
|
|
||||||
screen->saveClock24Hour(False);
|
|
||||||
#endif // HAVE_STRFTIME
|
|
||||||
|
|
||||||
sprintf(name_lookup, "session.screen%d.edgeSnapThreshold", screen_number);
|
|
||||||
sprintf(class_lookup, "Session.Screen%d.EdgeSnapThreshold", screen_number);
|
|
||||||
if (config.getValue(name_lookup, class_lookup, l))
|
|
||||||
screen->saveEdgeSnapThreshold(l);
|
|
||||||
else
|
|
||||||
screen->saveEdgeSnapThreshold(4);
|
|
||||||
|
|
||||||
sprintf(name_lookup, "session.screen%d.imageDither", screen_number);
|
|
||||||
sprintf(class_lookup, "Session.Screen%d.ImageDither", screen_number);
|
|
||||||
if (config.getValue("session.imageDither", "Session.ImageDither", b))
|
|
||||||
screen->saveImageDither((Bool)b);
|
|
||||||
else
|
|
||||||
screen->saveImageDither(True);
|
|
||||||
|
|
||||||
sprintf(name_lookup, "session.screen%d.rootCommand", screen_number);
|
|
||||||
sprintf(class_lookup, "Session.Screen%d.RootCommand", screen_number);
|
|
||||||
if (config.getValue(name_lookup, class_lookup, s))
|
|
||||||
screen->saveRootCommand(s.c_str());
|
|
||||||
else
|
|
||||||
screen->saveRootCommand(NULL);
|
|
||||||
|
|
||||||
if (config.getValue("session.opaqueMove", "Session.OpaqueMove", b))
|
|
||||||
screen->saveOpaqueMove((Bool)b);
|
|
||||||
else
|
|
||||||
screen->saveOpaqueMove(False);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Openbox::reload_rc(void) {
|
|
||||||
load_rc();
|
|
||||||
reconfigure();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Openbox::reconfigure(void) {
|
|
||||||
reconfigure_wait = True;
|
reconfigure_wait = True;
|
||||||
|
|
||||||
if (! timer->isTiming()) timer->start();
|
if (! timer->isTiming()) timer->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Openbox::real_reconfigure(void) {
|
void Openbox::real_reconfigure() {
|
||||||
grab();
|
grab();
|
||||||
|
|
||||||
config.load();
|
load();
|
||||||
config.setValue("session.styleFile", resource.style_file); // autosave's
|
save();
|
||||||
|
|
||||||
for (int i = 0, n = menuTimestamps->count(); i < n; i++) {
|
for (int i = 0, n = menuTimestamps->count(); i < n; i++) {
|
||||||
MenuTimestamp *ts = menuTimestamps->remove(0);
|
MenuTimestamp *ts = menuTimestamps->remove(0);
|
||||||
|
@ -1384,7 +1094,7 @@ void Openbox::real_reconfigure(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Openbox::checkMenu(void) {
|
void Openbox::checkMenu() {
|
||||||
Bool reread = False;
|
Bool reread = False;
|
||||||
LinkedListIterator<MenuTimestamp> it(menuTimestamps);
|
LinkedListIterator<MenuTimestamp> it(menuTimestamps);
|
||||||
for (MenuTimestamp *tmp = it.current(); tmp && (! reread);
|
for (MenuTimestamp *tmp = it.current(); tmp && (! reread);
|
||||||
|
@ -1403,14 +1113,14 @@ void Openbox::checkMenu(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Openbox::rereadMenu(void) {
|
void Openbox::rereadMenu() {
|
||||||
reread_menu_wait = True;
|
reread_menu_wait = True;
|
||||||
|
|
||||||
if (! timer->isTiming()) timer->start();
|
if (! timer->isTiming()) timer->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Openbox::real_rereadMenu(void) {
|
void Openbox::real_rereadMenu() {
|
||||||
for (int i = 0, n = menuTimestamps->count(); i < n; i++) {
|
for (int i = 0, n = menuTimestamps->count(); i < n; i++) {
|
||||||
MenuTimestamp *ts = menuTimestamps->remove(0);
|
MenuTimestamp *ts = menuTimestamps->remove(0);
|
||||||
|
|
||||||
|
@ -1459,7 +1169,7 @@ void Openbox::saveMenuFilename(const char *filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Openbox::timeout(void) {
|
void Openbox::timeout() {
|
||||||
if (reconfigure_wait)
|
if (reconfigure_wait)
|
||||||
real_reconfigure();
|
real_reconfigure();
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,8 @@ private:
|
||||||
public:
|
public:
|
||||||
DataSearch(Window w, Z *d): window(w), data(d) {}
|
DataSearch(Window w, Z *d): window(w), data(d) {}
|
||||||
|
|
||||||
inline const Window &getWindow(void) const { return window; }
|
inline const Window &getWindow() const { return window; }
|
||||||
inline Z *getData(void) { return data; }
|
inline Z *getData() { return data; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -119,28 +119,27 @@ private:
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void load_rc(void);
|
void load();
|
||||||
void save_rc(void);
|
void save();
|
||||||
void reload_rc(void);
|
void real_rereadMenu();
|
||||||
void real_rereadMenu(void);
|
void real_reconfigure();
|
||||||
void real_reconfigure(void);
|
|
||||||
|
|
||||||
virtual void process_event(XEvent *);
|
virtual void process_event(XEvent *);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Openbox(int, char **, char * = 0, char * = 0);
|
Openbox(int, char **, char * = 0, char * = 0);
|
||||||
virtual ~Openbox(void);
|
virtual ~Openbox();
|
||||||
|
|
||||||
#ifdef HAVE_GETPID
|
#ifdef HAVE_GETPID
|
||||||
inline const Atom &getOpenboxPidAtom(void) const { return openbox_pid; }
|
inline const Atom &getOpenboxPidAtom() const { return openbox_pid; }
|
||||||
#endif // HAVE_GETPID
|
#endif // HAVE_GETPID
|
||||||
|
|
||||||
Basemenu *searchMenu(Window);
|
Basemenu *searchMenu(Window);
|
||||||
|
|
||||||
OpenboxWindow *searchGroup(Window, OpenboxWindow *);
|
OpenboxWindow *searchGroup(Window, OpenboxWindow *);
|
||||||
OpenboxWindow *searchWindow(Window);
|
OpenboxWindow *searchWindow(Window);
|
||||||
inline OpenboxWindow *getFocusedWindow(void) { return focused_window; }
|
inline OpenboxWindow *getFocusedWindow() { return focused_window; }
|
||||||
|
|
||||||
BScreen *getScreen(int);
|
BScreen *getScreen(int);
|
||||||
BScreen *searchScreen(Window);
|
BScreen *searchScreen(Window);
|
||||||
|
@ -148,29 +147,29 @@ public:
|
||||||
inline Resource &getConfig() {
|
inline Resource &getConfig() {
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
inline const Time &getDoubleClickInterval(void) const
|
inline const Time &getDoubleClickInterval() const
|
||||||
{ return resource.double_click_interval; }
|
{ return resource.double_click_interval; }
|
||||||
inline const Time &getLastTime(void) const { return last_time; }
|
inline const Time &getLastTime() const { return last_time; }
|
||||||
|
|
||||||
Toolbar *searchToolbar(Window);
|
Toolbar *searchToolbar(Window);
|
||||||
|
|
||||||
inline const char *getStyleFilename(void) const
|
inline const char *getStyleFilename() const
|
||||||
{ return resource.style_file; }
|
{ return resource.style_file; }
|
||||||
inline const char *getMenuFilename(void) const
|
inline const char *getMenuFilename() const
|
||||||
{ return resource.menu_file; }
|
{ return resource.menu_file; }
|
||||||
|
|
||||||
inline const int &getColorsPerChannel(void) const
|
inline const int &getColorsPerChannel() const
|
||||||
{ return resource.colors_per_channel; }
|
{ return resource.colors_per_channel; }
|
||||||
|
|
||||||
inline const timeval &getAutoRaiseDelay(void) const
|
inline const timeval &getAutoRaiseDelay() const
|
||||||
{ return resource.auto_raise_delay; }
|
{ return resource.auto_raise_delay; }
|
||||||
|
|
||||||
inline const char *getTitleBarLayout(void) const
|
inline const char *getTitleBarLayout() const
|
||||||
{ return resource.titlebar_layout; }
|
{ return resource.titlebar_layout; }
|
||||||
|
|
||||||
inline const unsigned long &getCacheLife(void) const
|
inline const unsigned long &getCacheLife() const
|
||||||
{ return resource.cache_life; }
|
{ return resource.cache_life; }
|
||||||
inline const unsigned long &getCacheMax(void) const
|
inline const unsigned long &getCacheMax() const
|
||||||
{ return resource.cache_max; }
|
{ return resource.cache_max; }
|
||||||
|
|
||||||
inline void maskWindowEvents(Window w, OpenboxWindow *bw)
|
inline void maskWindowEvents(Window w, OpenboxWindow *bw)
|
||||||
|
@ -178,8 +177,7 @@ public:
|
||||||
inline void setNoFocus(Bool f) { no_focus = f; }
|
inline void setNoFocus(Bool f) { no_focus = f; }
|
||||||
|
|
||||||
void setFocusedWindow(OpenboxWindow *w);
|
void setFocusedWindow(OpenboxWindow *w);
|
||||||
void shutdown(void);
|
void shutdown();
|
||||||
void load_rc(BScreen *);
|
|
||||||
void saveStyleFilename(const char *);
|
void saveStyleFilename(const char *);
|
||||||
void saveMenuFilename(const char *);
|
void saveMenuFilename(const char *);
|
||||||
void saveMenuSearch(Window, Basemenu *);
|
void saveMenuSearch(Window, Basemenu *);
|
||||||
|
@ -191,13 +189,13 @@ public:
|
||||||
void removeToolbarSearch(Window);
|
void removeToolbarSearch(Window);
|
||||||
void removeGroupSearch(Window);
|
void removeGroupSearch(Window);
|
||||||
void restart(const char * = 0);
|
void restart(const char * = 0);
|
||||||
void reconfigure(void);
|
void reconfigure();
|
||||||
void rereadMenu(void);
|
void rereadMenu();
|
||||||
void checkMenu(void);
|
void checkMenu();
|
||||||
|
|
||||||
virtual Bool handleSignal(int);
|
virtual Bool handleSignal(int);
|
||||||
|
|
||||||
virtual void timeout(void);
|
virtual void timeout();
|
||||||
|
|
||||||
#ifdef SLIT
|
#ifdef SLIT
|
||||||
Slit *searchSlit(Window);
|
Slit *searchSlit(Window);
|
||||||
|
|
Loading…
Reference in a new issue