added first revision of the BestFit placement type.
moved RowSmart placement type out of placeWindow() to its own function like bestFit. Will continue moving other placement types into their own functions.
This commit is contained in:
parent
24f9448c2e
commit
424d476f7c
11 changed files with 267 additions and 113 deletions
3
AUTHORS
3
AUTHORS
|
@ -6,9 +6,10 @@ Project Maintainer:
|
|||
Developers:
|
||||
Ben Jansens (ben@orodu.net)
|
||||
Scott Moynes (smoynes@nexus.carleton.ca)
|
||||
Ruhi Bloodworth (ruhi@colophon.cjb.net)
|
||||
|
||||
Webmaster:
|
||||
Please apply :)
|
||||
Nick Jansens (jex@orodu.net)
|
||||
|
||||
-==============================================================================-
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@ $ #SmartCols
|
|||
# Smart Placement (Columns)
|
||||
$ #Cascade
|
||||
# Cascade Placement
|
||||
$ #BestFit
|
||||
# Best Fit Placement
|
||||
$ #LeftRight
|
||||
# Left to Right
|
||||
$ #RightLeft
|
||||
|
|
|
@ -215,6 +215,8 @@ Configmenu::Placementmenu::Placementmenu(Configmenu *cm) :
|
|||
BScreen::ColSmartPlacement);
|
||||
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuCascade,
|
||||
"Cascade Placement"), BScreen::CascadePlacement);
|
||||
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuBestFit,
|
||||
"Best Fit Placement"), BScreen::BestFitPlacement);
|
||||
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuLeftRight,
|
||||
"Left to Right"), BScreen::LeftRight);
|
||||
insert(i18n->getMessage(ConfigmenuSet, ConfigmenuRightLeft,
|
||||
|
@ -237,6 +239,10 @@ Configmenu::Placementmenu::Placementmenu(Configmenu *cm) :
|
|||
case BScreen::CascadePlacement:
|
||||
setItemSelected(2, True);
|
||||
break;
|
||||
|
||||
case BScreen::BestFitPlacement:
|
||||
setItemSelected(3, True);
|
||||
break;
|
||||
}
|
||||
|
||||
Bool rl = (configmenu->screen->getRowPlacementDirection() ==
|
||||
|
@ -244,11 +250,11 @@ Configmenu::Placementmenu::Placementmenu(Configmenu *cm) :
|
|||
tb = (configmenu->screen->getColPlacementDirection() ==
|
||||
BScreen::TopBottom);
|
||||
|
||||
setItemSelected(3, rl);
|
||||
setItemSelected(4, ! rl);
|
||||
setItemSelected(4, rl);
|
||||
setItemSelected(5, ! rl);
|
||||
|
||||
setItemSelected(5, tb);
|
||||
setItemSelected(6, ! tb);
|
||||
setItemSelected(6, tb);
|
||||
setItemSelected(7, ! tb);
|
||||
}
|
||||
|
||||
void Configmenu::Placementmenu::itemSelected(int button, int index) {
|
||||
|
@ -267,6 +273,7 @@ void Configmenu::Placementmenu::itemSelected(int button, int index) {
|
|||
setItemSelected(0, True);
|
||||
setItemSelected(1, False);
|
||||
setItemSelected(2, False);
|
||||
setItemSelected(3, False);
|
||||
|
||||
break;
|
||||
|
||||
|
@ -276,6 +283,7 @@ void Configmenu::Placementmenu::itemSelected(int button, int index) {
|
|||
setItemSelected(0, False);
|
||||
setItemSelected(1, True);
|
||||
setItemSelected(2, False);
|
||||
setItemSelected(3, False);
|
||||
|
||||
break;
|
||||
|
||||
|
@ -285,22 +293,33 @@ void Configmenu::Placementmenu::itemSelected(int button, int index) {
|
|||
setItemSelected(0, False);
|
||||
setItemSelected(1, False);
|
||||
setItemSelected(2, True);
|
||||
setItemSelected(3, False);
|
||||
|
||||
break;
|
||||
|
||||
case BScreen::BestFitPlacement:
|
||||
configmenu->screen->savePlacementPolicy(item->function());
|
||||
|
||||
setItemSelected(0, False);
|
||||
setItemSelected(1, False);
|
||||
setItemSelected(2, False);
|
||||
setItemSelected(3, True);
|
||||
|
||||
break;
|
||||
|
||||
case BScreen::LeftRight:
|
||||
configmenu->screen->saveRowPlacementDirection(BScreen::LeftRight);
|
||||
|
||||
setItemSelected(3, True);
|
||||
setItemSelected(4, False);
|
||||
setItemSelected(4, True);
|
||||
setItemSelected(5, False);
|
||||
|
||||
break;
|
||||
|
||||
case BScreen::RightLeft:
|
||||
configmenu->screen->saveRowPlacementDirection(BScreen::RightLeft);
|
||||
|
||||
setItemSelected(3, False);
|
||||
setItemSelected(4, True);
|
||||
setItemSelected(4, False);
|
||||
setItemSelected(5, True);
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef __geometru_h
|
||||
#ifndef __geometry_h
|
||||
#define __geometry_h
|
||||
|
||||
class Point{
|
||||
|
@ -99,4 +99,4 @@ public:
|
|||
bool Intersect(const Rect &r) const;
|
||||
};
|
||||
|
||||
#endif // __geomtry_h
|
||||
#endif // __geometry_h
|
||||
|
|
|
@ -30,7 +30,7 @@ CPPFLAGS= @CPPFLAGS@ @SHAPE@ @SLIT@ @INTERLACE@ @ORDEREDPSEUDO@ \
|
|||
|
||||
bin_PROGRAMS= openbox
|
||||
|
||||
openbox_SOURCES= BaseDisplay.cc Basemenu.cc Clientmenu.cc Configmenu.cc Iconmenu.cc Image.cc LinkedList.cc Netizen.cc Resource.cc Rootmenu.cc Screen.cc Slit.cc Timer.cc Toolbar.cc Window.cc Windowmenu.cc Workspace.cc Workspacemenu.cc openbox.cc bsd-snprintf.c i18n.cc main.cc
|
||||
openbox_SOURCES= BaseDisplay.cc Basemenu.cc Clientmenu.cc Configmenu.cc Geometry.cc Iconmenu.cc Image.cc LinkedList.cc Netizen.cc Resource.cc Rootmenu.cc Screen.cc Slit.cc Timer.cc Toolbar.cc Window.cc Windowmenu.cc Workspace.cc Workspacemenu.cc openbox.cc bsd-snprintf.c i18n.cc main.cc
|
||||
|
||||
MAINTAINERCLEANFILES= Makefile.in
|
||||
|
||||
|
@ -39,71 +39,73 @@ distclean-local:
|
|||
|
||||
# local dependencies
|
||||
|
||||
Geometry.o: Geometry.cc Geometry.h
|
||||
Resource.o: Resource.cc Resource.h
|
||||
BaseDisplay.o: BaseDisplay.cc i18n.h BaseDisplay.h LinkedList.h \
|
||||
Timer.h
|
||||
Basemenu.o: Basemenu.cc i18n.h openbox.h BaseDisplay.h \
|
||||
LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \
|
||||
LinkedList.h Timer.h Image.h Iconmenu.h Basemenu.h \
|
||||
Windowmenu.h Slit.h Screen.h Configmenu.h Netizen.h Rootmenu.h \
|
||||
Workspace.h Workspacemenu.h Resource.h
|
||||
Clientmenu.o: Clientmenu.cc openbox.h BaseDisplay.h LinkedList.h \
|
||||
Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \
|
||||
Clientmenu.h Workspace.h Screen.h Configmenu.h Netizen.h \
|
||||
Rootmenu.h Workspacemenu.h Resource.h
|
||||
Rootmenu.h Workspacemenu.h Resource.h Geometry.h
|
||||
Configmenu.o: Configmenu.cc i18n.h Configmenu.h Basemenu.h \
|
||||
LinkedList.h Screen.h BaseDisplay.h Timer.h Iconmenu.h Netizen.h \
|
||||
Rootmenu.h Workspace.h Workspacemenu.h openbox.h Image.h \
|
||||
Window.h Windowmenu.h Slit.h Toolbar.h Resource.h
|
||||
Window.h Windowmenu.h Slit.h Toolbar.h Resource.h Geometry.h
|
||||
Icon.o: Iconmenu.cc i18n.h openbox.h BaseDisplay.h LinkedList.h \
|
||||
Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \
|
||||
Screen.h Configmenu.h Netizen.h Rootmenu.h Workspace.h \
|
||||
Workspacemenu.h Toolbar.h Resource.h
|
||||
Workspacemenu.h Toolbar.h Resource.h Geometry.h
|
||||
Image.o: Image.cc i18n.h BaseDisplay.h LinkedList.h Timer.h \
|
||||
Image.h
|
||||
LinkedList.o: LinkedList.cc LinkedList.h
|
||||
Netizen.o: Netizen.cc Netizen.h BaseDisplay.h LinkedList.h Timer.h \
|
||||
Screen.h Configmenu.h Basemenu.h openbox.h Image.h Window.h \
|
||||
Iconmenu.h Windowmenu.h Slit.h Rootmenu.h Workspace.h \
|
||||
Workspacemenu.h Resource.h
|
||||
Workspacemenu.h Resource.h Geometry.h
|
||||
Rootmenu.o: Rootmenu.cc openbox.h BaseDisplay.h LinkedList.h \
|
||||
Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \
|
||||
Rootmenu.h Screen.h Configmenu.h Netizen.h Workspace.h \
|
||||
Workspacemenu.h Resource.h
|
||||
Workspacemenu.h Resource.h Geometry.h
|
||||
Screen.o: Screen.cc i18n.h bsd-snprintf.h openbox.h BaseDisplay.h \
|
||||
LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \
|
||||
Windowmenu.h Slit.h Clientmenu.h Workspace.h Screen.h Configmenu.h \
|
||||
Netizen.h Rootmenu.h Workspacemenu.h Toolbar.h Resource.h
|
||||
Netizen.h Rootmenu.h Workspacemenu.h Toolbar.h Resource.h Geometry.h
|
||||
Slit.o: Slit.cc i18n.h openbox.h BaseDisplay.h LinkedList.h \
|
||||
Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \
|
||||
Screen.h Configmenu.h Netizen.h Rootmenu.h Workspace.h \
|
||||
Workspacemenu.h Toolbar.h Resource.h
|
||||
Workspacemenu.h Toolbar.h Resource.h Geometry.h
|
||||
Timer.o: Timer.cc BaseDisplay.h LinkedList.h Timer.h
|
||||
Toolbar.o: Toolbar.cc i18n.h openbox.h BaseDisplay.h LinkedList.h \
|
||||
Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \
|
||||
Clientmenu.h Workspace.h Rootmenu.h Screen.h Configmenu.h \
|
||||
Netizen.h Workspacemenu.h Toolbar.h Resource.h
|
||||
Netizen.h Workspacemenu.h Toolbar.h Resource.h Geometry.h
|
||||
Window.o: Window.cc i18n.h openbox.h BaseDisplay.h LinkedList.h \
|
||||
Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \
|
||||
Screen.h Configmenu.h Netizen.h Rootmenu.h Workspace.h \
|
||||
Workspacemenu.h Toolbar.h Resource.h
|
||||
Workspacemenu.h Toolbar.h Resource.h Geometry.h
|
||||
Windowmenu.o: Windowmenu.cc i18n.h openbox.h BaseDisplay.h \
|
||||
LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \
|
||||
Windowmenu.h Slit.h Screen.h Configmenu.h Netizen.h Rootmenu.h \
|
||||
Workspace.h Workspacemenu.h Resource.h
|
||||
Workspace.h Workspacemenu.h Resource.h Geometry.h
|
||||
Workspace.o: Workspace.cc i18n.h openbox.h BaseDisplay.h \
|
||||
LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \
|
||||
Windowmenu.h Slit.h Clientmenu.h Workspace.h Screen.h \
|
||||
Configmenu.h Netizen.h Rootmenu.h Workspacemenu.h Toolbar.h Resource.h
|
||||
Configmenu.h Netizen.h Rootmenu.h Workspacemenu.h Toolbar.h Resource.h \
|
||||
Geometry.h Geometry.h
|
||||
Workspacemenu.o: Workspacemenu.cc i18n.h openbox.h BaseDisplay.h \
|
||||
LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \
|
||||
Windowmenu.h Slit.h Screen.h Configmenu.h Netizen.h Rootmenu.h \
|
||||
Workspace.h Workspacemenu.h Toolbar.h Resource.h
|
||||
Workspace.h Workspacemenu.h Toolbar.h Resource.h Geometry.h
|
||||
openbox.o: openbox.cc i18n.h openbox.h BaseDisplay.h \
|
||||
LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \
|
||||
Windowmenu.h Slit.h Clientmenu.h Workspace.h Rootmenu.h \
|
||||
Screen.h Configmenu.h Netizen.h Workspacemenu.h Toolbar.h Resource.h
|
||||
Screen.h Configmenu.h Netizen.h Workspacemenu.h Toolbar.h Resource.h Geometry.h
|
||||
bsd-snprintf.o: bsd-snprintf.c bsd-snprintf.h
|
||||
i18n.o: i18n.cc i18n.h
|
||||
main.o: main.cc ../version.h i18n.h openbox.h BaseDisplay.h \
|
||||
LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \
|
||||
Windowmenu.h Slit.h Resource.h
|
||||
Windowmenu.h Slit.h Resource.h Geometry.h
|
||||
|
|
|
@ -104,7 +104,7 @@ CPPFLAGS = @CPPFLAGS@ @SHAPE@ @SLIT@ @INTERLACE@ @ORDEREDPSEUDO@ @DEBUG@ @NEWWMS
|
|||
|
||||
bin_PROGRAMS = openbox
|
||||
|
||||
openbox_SOURCES = BaseDisplay.cc Basemenu.cc Clientmenu.cc Configmenu.cc Iconmenu.cc Image.cc LinkedList.cc Netizen.cc Resource.cc Rootmenu.cc Screen.cc Slit.cc Timer.cc Toolbar.cc Window.cc Windowmenu.cc Workspace.cc Workspacemenu.cc openbox.cc bsd-snprintf.c i18n.cc main.cc
|
||||
openbox_SOURCES = BaseDisplay.cc Basemenu.cc Clientmenu.cc Configmenu.cc Geometry.cc Iconmenu.cc Image.cc LinkedList.cc Netizen.cc Resource.cc Rootmenu.cc Screen.cc Slit.cc Timer.cc Toolbar.cc Window.cc Windowmenu.cc Workspace.cc Workspacemenu.cc openbox.cc bsd-snprintf.c i18n.cc main.cc
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
|
@ -121,9 +121,9 @@ X_LIBS = @X_LIBS@
|
|||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||
X_PRE_LIBS = @X_PRE_LIBS@
|
||||
openbox_OBJECTS = BaseDisplay.o Basemenu.o Clientmenu.o Configmenu.o \
|
||||
Iconmenu.o Image.o LinkedList.o Netizen.o Resource.o Rootmenu.o \
|
||||
Screen.o Slit.o Timer.o Toolbar.o Window.o Windowmenu.o Workspace.o \
|
||||
Workspacemenu.o openbox.o bsd-snprintf.o i18n.o main.o
|
||||
Geometry.o Iconmenu.o Image.o LinkedList.o Netizen.o Resource.o \
|
||||
Rootmenu.o Screen.o Slit.o Timer.o Toolbar.o Window.o Windowmenu.o \
|
||||
Workspace.o Workspacemenu.o openbox.o bsd-snprintf.o i18n.o main.o
|
||||
openbox_LDADD = $(LDADD)
|
||||
openbox_DEPENDENCIES =
|
||||
openbox_LDFLAGS =
|
||||
|
@ -143,11 +143,12 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
|||
TAR = tar
|
||||
GZIP_ENV = --best
|
||||
DEP_FILES = .deps/BaseDisplay.P .deps/Basemenu.P .deps/Clientmenu.P \
|
||||
.deps/Configmenu.P .deps/Iconmenu.P .deps/Image.P .deps/LinkedList.P \
|
||||
.deps/Netizen.P .deps/Resource.P .deps/Rootmenu.P .deps/Screen.P \
|
||||
.deps/Slit.P .deps/Timer.P .deps/Toolbar.P .deps/Window.P \
|
||||
.deps/Windowmenu.P .deps/Workspace.P .deps/Workspacemenu.P \
|
||||
.deps/bsd-snprintf.P .deps/i18n.P .deps/main.P .deps/openbox.P
|
||||
.deps/Configmenu.P .deps/Geometry.P .deps/Iconmenu.P .deps/Image.P \
|
||||
.deps/LinkedList.P .deps/Netizen.P .deps/Resource.P .deps/Rootmenu.P \
|
||||
.deps/Screen.P .deps/Slit.P .deps/Timer.P .deps/Toolbar.P \
|
||||
.deps/Window.P .deps/Windowmenu.P .deps/Workspace.P \
|
||||
.deps/Workspacemenu.P .deps/bsd-snprintf.P .deps/i18n.P .deps/main.P \
|
||||
.deps/openbox.P
|
||||
SOURCES = $(openbox_SOURCES)
|
||||
OBJECTS = $(openbox_OBJECTS)
|
||||
|
||||
|
@ -389,74 +390,76 @@ distclean-local:
|
|||
|
||||
# local dependencies
|
||||
|
||||
Geometry.o: Geometry.cc Geometry.h
|
||||
Resource.o: Resource.cc Resource.h
|
||||
BaseDisplay.o: BaseDisplay.cc i18n.h BaseDisplay.h LinkedList.h \
|
||||
Timer.h
|
||||
Basemenu.o: Basemenu.cc i18n.h openbox.h BaseDisplay.h \
|
||||
LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \
|
||||
LinkedList.h Timer.h Image.h Iconmenu.h Basemenu.h \
|
||||
Windowmenu.h Slit.h Screen.h Configmenu.h Netizen.h Rootmenu.h \
|
||||
Workspace.h Workspacemenu.h Resource.h
|
||||
Clientmenu.o: Clientmenu.cc openbox.h BaseDisplay.h LinkedList.h \
|
||||
Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \
|
||||
Clientmenu.h Workspace.h Screen.h Configmenu.h Netizen.h \
|
||||
Rootmenu.h Workspacemenu.h Resource.h
|
||||
Rootmenu.h Workspacemenu.h Resource.h Geometry.h
|
||||
Configmenu.o: Configmenu.cc i18n.h Configmenu.h Basemenu.h \
|
||||
LinkedList.h Screen.h BaseDisplay.h Timer.h Iconmenu.h Netizen.h \
|
||||
Rootmenu.h Workspace.h Workspacemenu.h openbox.h Image.h \
|
||||
Window.h Windowmenu.h Slit.h Toolbar.h Resource.h
|
||||
Window.h Windowmenu.h Slit.h Toolbar.h Resource.h Geometry.h
|
||||
Icon.o: Iconmenu.cc i18n.h openbox.h BaseDisplay.h LinkedList.h \
|
||||
Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \
|
||||
Screen.h Configmenu.h Netizen.h Rootmenu.h Workspace.h \
|
||||
Workspacemenu.h Toolbar.h Resource.h
|
||||
Workspacemenu.h Toolbar.h Resource.h Geometry.h
|
||||
Image.o: Image.cc i18n.h BaseDisplay.h LinkedList.h Timer.h \
|
||||
Image.h
|
||||
LinkedList.o: LinkedList.cc LinkedList.h
|
||||
Netizen.o: Netizen.cc Netizen.h BaseDisplay.h LinkedList.h Timer.h \
|
||||
Screen.h Configmenu.h Basemenu.h openbox.h Image.h Window.h \
|
||||
Iconmenu.h Windowmenu.h Slit.h Rootmenu.h Workspace.h \
|
||||
Workspacemenu.h Resource.h
|
||||
Workspacemenu.h Resource.h Geometry.h
|
||||
Rootmenu.o: Rootmenu.cc openbox.h BaseDisplay.h LinkedList.h \
|
||||
Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \
|
||||
Rootmenu.h Screen.h Configmenu.h Netizen.h Workspace.h \
|
||||
Workspacemenu.h Resource.h
|
||||
Workspacemenu.h Resource.h Geometry.h
|
||||
Screen.o: Screen.cc i18n.h bsd-snprintf.h openbox.h BaseDisplay.h \
|
||||
LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \
|
||||
Windowmenu.h Slit.h Clientmenu.h Workspace.h Screen.h Configmenu.h \
|
||||
Netizen.h Rootmenu.h Workspacemenu.h Toolbar.h Resource.h
|
||||
Netizen.h Rootmenu.h Workspacemenu.h Toolbar.h Resource.h Geometry.h
|
||||
Slit.o: Slit.cc i18n.h openbox.h BaseDisplay.h LinkedList.h \
|
||||
Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \
|
||||
Screen.h Configmenu.h Netizen.h Rootmenu.h Workspace.h \
|
||||
Workspacemenu.h Toolbar.h Resource.h
|
||||
Workspacemenu.h Toolbar.h Resource.h Geometry.h
|
||||
Timer.o: Timer.cc BaseDisplay.h LinkedList.h Timer.h
|
||||
Toolbar.o: Toolbar.cc i18n.h openbox.h BaseDisplay.h LinkedList.h \
|
||||
Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \
|
||||
Clientmenu.h Workspace.h Rootmenu.h Screen.h Configmenu.h \
|
||||
Netizen.h Workspacemenu.h Toolbar.h Resource.h
|
||||
Netizen.h Workspacemenu.h Toolbar.h Resource.h Geometry.h
|
||||
Window.o: Window.cc i18n.h openbox.h BaseDisplay.h LinkedList.h \
|
||||
Timer.h Image.h Window.h Iconmenu.h Basemenu.h Windowmenu.h Slit.h \
|
||||
Screen.h Configmenu.h Netizen.h Rootmenu.h Workspace.h \
|
||||
Workspacemenu.h Toolbar.h Resource.h
|
||||
Workspacemenu.h Toolbar.h Resource.h Geometry.h
|
||||
Windowmenu.o: Windowmenu.cc i18n.h openbox.h BaseDisplay.h \
|
||||
LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \
|
||||
Windowmenu.h Slit.h Screen.h Configmenu.h Netizen.h Rootmenu.h \
|
||||
Workspace.h Workspacemenu.h Resource.h
|
||||
Workspace.h Workspacemenu.h Resource.h Geometry.h
|
||||
Workspace.o: Workspace.cc i18n.h openbox.h BaseDisplay.h \
|
||||
LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \
|
||||
Windowmenu.h Slit.h Clientmenu.h Workspace.h Screen.h \
|
||||
Configmenu.h Netizen.h Rootmenu.h Workspacemenu.h Toolbar.h Resource.h
|
||||
Configmenu.h Netizen.h Rootmenu.h Workspacemenu.h Toolbar.h Resource.h \
|
||||
Geometry.h Geometry.h
|
||||
Workspacemenu.o: Workspacemenu.cc i18n.h openbox.h BaseDisplay.h \
|
||||
LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \
|
||||
Windowmenu.h Slit.h Screen.h Configmenu.h Netizen.h Rootmenu.h \
|
||||
Workspace.h Workspacemenu.h Toolbar.h Resource.h
|
||||
Workspace.h Workspacemenu.h Toolbar.h Resource.h Geometry.h
|
||||
openbox.o: openbox.cc i18n.h openbox.h BaseDisplay.h \
|
||||
LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \
|
||||
Windowmenu.h Slit.h Clientmenu.h Workspace.h Rootmenu.h \
|
||||
Screen.h Configmenu.h Netizen.h Workspacemenu.h Toolbar.h Resource.h
|
||||
Screen.h Configmenu.h Netizen.h Workspacemenu.h Toolbar.h Resource.h Geometry.h
|
||||
bsd-snprintf.o: bsd-snprintf.c bsd-snprintf.h
|
||||
i18n.o: i18n.cc i18n.h
|
||||
main.o: main.cc ../version.h i18n.h openbox.h BaseDisplay.h \
|
||||
LinkedList.h Timer.h Image.h Window.h Iconmenu.h Basemenu.h \
|
||||
Windowmenu.h Slit.h Resource.h
|
||||
Windowmenu.h Slit.h Resource.h Geometry.h
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
|
|
@ -338,8 +338,8 @@ public:
|
|||
void updateNetizenWindowRaise(Window);
|
||||
void updateNetizenWindowLower(Window);
|
||||
|
||||
enum { RowSmartPlacement = 1, ColSmartPlacement, CascadePlacement, LeftRight,
|
||||
RightLeft, TopBottom, BottomTop };
|
||||
enum { RowSmartPlacement = 1, ColSmartPlacement, CascadePlacement,
|
||||
BestFitPlacement, LeftRight, RightLeft, TopBottom, BottomTop };
|
||||
enum { LeftJustify = 1, RightJustify, CenterJustify };
|
||||
enum { RoundBullet = 1, TriangleBullet, SquareBullet, NoBullet };
|
||||
enum { Restart = 1, RestartOther, Exit, Shutdown, Execute, Reconfigure,
|
||||
|
|
20
src/Window.h
20
src/Window.h
|
@ -32,6 +32,7 @@
|
|||
#include "BaseDisplay.h"
|
||||
#include "Timer.h"
|
||||
#include "Windowmenu.h"
|
||||
#include "Geometry.h"
|
||||
|
||||
// forward declaration
|
||||
class OpenboxWindow;
|
||||
|
@ -286,6 +287,25 @@ public:
|
|||
inline const unsigned int &getTitleHeight(void) const
|
||||
{ return frame.title_h; }
|
||||
|
||||
inline const Point getOrigin() const {
|
||||
return Point(frame.x, frame.y);
|
||||
}
|
||||
inline const Point getClientOrigin() const {
|
||||
return Point(client.x, client.y);
|
||||
}
|
||||
inline const Size getSize() const {
|
||||
return Size(frame.width, frame.height);
|
||||
}
|
||||
inline const Size getClientSize() const {
|
||||
return Size(client.width, client.height);
|
||||
}
|
||||
inline const Rect getArea() const {
|
||||
return Rect(frame.x, frame.y, frame.width, frame.height);
|
||||
}
|
||||
inline const Rect getClientArea() const {
|
||||
return Rect(client.x, client.y, client.width, client.height);
|
||||
}
|
||||
|
||||
inline void setWindowNumber(int n) { window_number = n; }
|
||||
|
||||
Bool validateClient(void);
|
||||
|
|
221
src/Workspace.cc
221
src/Workspace.cc
|
@ -1,4 +1,5 @@
|
|||
// Workspace.cc for Openbox
|
||||
// Copyright (c) 2002 - 2002 Ben Jansens (ben@orodu.net)
|
||||
// Copyright (c) 2001 Sean 'Shaleh' Perry <shaleh@debian.org>
|
||||
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
|
||||
//
|
||||
|
@ -41,15 +42,22 @@
|
|||
#include "Window.h"
|
||||
#include "Workspace.h"
|
||||
#include "Windowmenu.h"
|
||||
#include "Geometry.h"
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
# include <stdio.h>
|
||||
#endif // HAVE_STDIO_H
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif // HAVE_STDLIB_H
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
# include <string.h>
|
||||
#endif // STDC_HEADERS
|
||||
|
||||
#include <vector>
|
||||
typedef vector<Rect> rectList;
|
||||
|
||||
Workspace::Workspace(BScreen *scrn, int i) {
|
||||
screen = scrn;
|
||||
|
@ -322,7 +330,137 @@ void Workspace::shutdown(void) {
|
|||
}
|
||||
}
|
||||
|
||||
static rectList calcSpace(const OpenboxWindow &win, const rectList &spaces) {
|
||||
rectList result;
|
||||
rectList::const_iterator siter;
|
||||
for(siter=spaces.begin(); siter!=spaces.end(); ++siter) {
|
||||
if(win.getArea().Intersect(*siter)) {
|
||||
//Check for space to the left of the window
|
||||
if(win.getXFrame() > siter->x())
|
||||
result.push_back(Rect(siter->x(), siter->y(),
|
||||
win.getXFrame() - siter->x() - 1,
|
||||
siter->h()));
|
||||
//Check for space above the window
|
||||
if(win.getYFrame() > siter->y())
|
||||
result.push_back(Rect(siter->x(), siter->y(),
|
||||
siter->w(),
|
||||
win.getYFrame() - siter->y() - 1));
|
||||
//Check for space to the right of the window
|
||||
if((win.getXFrame()+win.getWidth()) <
|
||||
(siter->x()+siter->w()))
|
||||
result.push_back(Rect(win.getXFrame() + win.getWidth() + 1,
|
||||
siter->y(),
|
||||
siter->x() + siter->w() -
|
||||
win.getXFrame() - win.getWidth() - 1,
|
||||
siter->h()));
|
||||
//Check for space below the window
|
||||
if((win.getYFrame()+win.getHeight()) <
|
||||
(siter->y()+siter->h()))
|
||||
result.push_back(Rect(siter->x(),
|
||||
win.getYFrame() + win.getHeight() + 1,
|
||||
siter->w(),
|
||||
siter->y() + siter->h()-
|
||||
win.getYFrame() - win.getHeight() - 1));
|
||||
|
||||
}
|
||||
else
|
||||
result.push_back(*siter);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//BestFitPlacement finds the smallest free space that fits the window
|
||||
//to be placed. It currentl ignores whether placement is right to left or top
|
||||
//to bottom.
|
||||
Point *Workspace::bestFitPlacement(const Size &win_size, const Rect &space)
|
||||
{
|
||||
const Rect *best;
|
||||
rectList spaces;
|
||||
LinkedListIterator<OpenboxWindow> it(windowList);
|
||||
rectList::const_iterator siter;
|
||||
spaces.push_back(space); //initially the entire screen is free
|
||||
it.reset();
|
||||
|
||||
//Find Free Spaces
|
||||
for (OpenboxWindow *cur=it.current(); cur!=NULL; it++, cur=it.current())
|
||||
spaces = calcSpace(*cur, spaces);
|
||||
|
||||
//Find first space that fits the window
|
||||
best = 0;
|
||||
for (siter=spaces.begin(); siter!=spaces.end(); ++siter) {
|
||||
if ((siter->w() >= win_size.w()) &&
|
||||
(siter->h() >= win_size.h()))
|
||||
best = siter;
|
||||
}
|
||||
|
||||
if (best != 0)
|
||||
return new Point(best->origin());
|
||||
else
|
||||
return new Point(200, 0);
|
||||
}
|
||||
|
||||
inline Point *Workspace::rowSmartPlacement(const Size &win_size,
|
||||
const Rect &space){
|
||||
bool placed=false;
|
||||
int test_x, test_y, place_x = 0, place_y = 0;
|
||||
int start_pos = 0;
|
||||
int change_y =
|
||||
((screen->getColPlacementDirection() == BScreen::TopBottom) ? 1 : -1);
|
||||
int change_x =
|
||||
((screen->getRowPlacementDirection() == BScreen::LeftRight) ? 1 : -1);
|
||||
int delta_x = 8, delta_y = 8;
|
||||
LinkedListIterator<OpenboxWindow> it(windowList);
|
||||
|
||||
test_y = (screen->getColPlacementDirection() == BScreen::TopBottom) ?
|
||||
start_pos : screen->getHeight() - win_size.h() - start_pos;
|
||||
|
||||
while(!placed &&
|
||||
((screen->getColPlacementDirection() == BScreen::BottomTop) ?
|
||||
test_y > 0 : test_y + win_size.h() < (signed) space.h())) {
|
||||
test_x = (screen->getRowPlacementDirection() == BScreen::LeftRight) ?
|
||||
start_pos : space.w() - win_size.w() - start_pos;
|
||||
while (!placed &&
|
||||
((screen->getRowPlacementDirection() == BScreen::RightLeft) ?
|
||||
test_x > 0 : test_x + win_size.w() < (signed) space.w())) {
|
||||
placed = true;
|
||||
|
||||
it.reset();
|
||||
for (OpenboxWindow *curr = it.current(); placed && curr;
|
||||
it++, curr = it.current()) {
|
||||
int curr_w = curr->getWidth() + (screen->getBorderWidth() * 4);
|
||||
int curr_h =
|
||||
((curr->isShaded()) ? curr->getTitleHeight() : curr->getHeight()) +
|
||||
(screen->getBorderWidth() * 4);
|
||||
|
||||
if (curr->getXFrame() < test_x + win_size.w() &&
|
||||
curr->getXFrame() + curr_w > test_x &&
|
||||
curr->getYFrame() < test_y + win_size.h() &&
|
||||
curr->getYFrame() + curr_h > test_y) {
|
||||
placed = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Removed code for checking toolbar and slit
|
||||
// The space passed in should not include either
|
||||
|
||||
if (placed) {
|
||||
place_x = test_x;
|
||||
place_y = test_y;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
test_x += (change_x * delta_x);
|
||||
}
|
||||
|
||||
test_y += (change_y * delta_y);
|
||||
}
|
||||
return new Point(place_x, place_y);
|
||||
}
|
||||
|
||||
void Workspace::placeWindow(OpenboxWindow *win) {
|
||||
assert(win != NULL);
|
||||
|
||||
Bool placed = False;
|
||||
|
||||
const int win_w = win->getWidth() + (screen->getBorderWidth() * 4),
|
||||
|
@ -351,68 +489,31 @@ void Workspace::placeWindow(OpenboxWindow *win) {
|
|||
int test_x, test_y, place_x = 0, place_y = 0;
|
||||
LinkedListIterator<OpenboxWindow> it(windowList);
|
||||
|
||||
Rect space(0, 0,
|
||||
screen->getWidth(),
|
||||
screen->getHeight()
|
||||
);
|
||||
Size window_size(win_w, win_h);
|
||||
|
||||
switch (screen->getPlacementPolicy()) {
|
||||
case BScreen::RowSmartPlacement: {
|
||||
test_y = (screen->getColPlacementDirection() == BScreen::TopBottom) ?
|
||||
start_pos : screen->getHeight() - win_h - start_pos;
|
||||
|
||||
while (!placed &&
|
||||
((screen->getColPlacementDirection() == BScreen::BottomTop) ?
|
||||
test_y > 0 : test_y + win_h < (signed) screen->getHeight())) {
|
||||
test_x = (screen->getRowPlacementDirection() == BScreen::LeftRight) ?
|
||||
start_pos : screen->getWidth() - win_w - start_pos;
|
||||
|
||||
while (!placed &&
|
||||
((screen->getRowPlacementDirection() == BScreen::RightLeft) ?
|
||||
test_x > 0 : test_x + win_w < (signed) screen->getWidth())) {
|
||||
placed = True;
|
||||
|
||||
it.reset();
|
||||
for (OpenboxWindow *curr = it.current(); placed && curr;
|
||||
it++, curr = it.current()) {
|
||||
if (curr->isMaximizedFull()) // fully maximized, ignore it
|
||||
continue;
|
||||
int curr_w = curr->getWidth() + (screen->getBorderWidth() * 4);
|
||||
int curr_h =
|
||||
((curr->isShaded()) ? curr->getTitleHeight() : curr->getHeight()) +
|
||||
(screen->getBorderWidth() * 4);
|
||||
|
||||
if (curr->getXFrame() < test_x + win_w &&
|
||||
curr->getXFrame() + curr_w > test_x &&
|
||||
curr->getYFrame() < test_y + win_h &&
|
||||
curr->getYFrame() + curr_h > test_y) {
|
||||
placed = False;
|
||||
}
|
||||
}
|
||||
|
||||
if (placed &&
|
||||
(toolbar_x < test_x + win_w &&
|
||||
toolbar_x + toolbar_w > test_x &&
|
||||
toolbar_y < test_y + win_h &&
|
||||
toolbar_y + toolbar_h > test_y)
|
||||
#ifdef SLIT
|
||||
||
|
||||
(slit_x < test_x + win_w &&
|
||||
slit_x + slit_w > test_x &&
|
||||
slit_y < test_y + win_h &&
|
||||
slit_y + slit_h > test_y)
|
||||
#endif // SLIT
|
||||
)
|
||||
placed = False;
|
||||
|
||||
if (placed) {
|
||||
place_x = test_x;
|
||||
place_y = test_y;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
test_x += (change_x * delta_x);
|
||||
}
|
||||
|
||||
test_y += (change_y * delta_y);
|
||||
case BScreen::BestFitPlacement: {
|
||||
Point *spot = bestFitPlacement(window_size, space);
|
||||
if (spot != NULL) {
|
||||
place_x=spot->x();
|
||||
place_y=spot->y();
|
||||
delete spot;
|
||||
placed=true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BScreen::RowSmartPlacement: {
|
||||
Point *spot=rowSmartPlacement(window_size, space);
|
||||
if (spot != NULL) {
|
||||
place_x=spot->x();
|
||||
place_y=spot->y();
|
||||
delete spot;
|
||||
placed=true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <X11/Xlib.h>
|
||||
|
||||
#include "LinkedList.h"
|
||||
#include "Geometry.h"
|
||||
|
||||
class BScreen;
|
||||
class Clientmenu;
|
||||
|
@ -46,6 +47,8 @@ private:
|
|||
|
||||
protected:
|
||||
void placeWindow(OpenboxWindow *);
|
||||
Point *bestFitPlacement(const Size &win_size, const Rect &space);
|
||||
Point *rowSmartPlacement(const Size &win_size, const Rect &space);
|
||||
|
||||
|
||||
public:
|
||||
|
|
|
@ -1043,6 +1043,7 @@ void Openbox::save_rc(void) {
|
|||
|
||||
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;
|
||||
|
@ -1363,6 +1364,8 @@ void Openbox::load_rc(BScreen *screen) {
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue