10bbfda8aSnia/*
20bbfda8aSnia * Functions related to window occupation and workspaces.  Not the
30bbfda8aSnia * workspace manager itself; that's off with the icon managers.
40bbfda8aSnia */
50bbfda8aSnia
60bbfda8aSnia#include "ctwm.h"
70bbfda8aSnia
80bbfda8aSnia#include "functions_internal.h"
90bbfda8aSnia#include "screen.h"
100bbfda8aSnia#include "occupation.h"
110bbfda8aSnia#include "workspace_utils.h"
120bbfda8aSnia
130bbfda8aSnia
140bbfda8aSnia
150bbfda8aSnia/*
160bbfda8aSnia * Setting occupation on a specific window.
170bbfda8aSnia */
180bbfda8aSniaDFHANDLER(occupy)
190bbfda8aSnia{
200bbfda8aSnia	Occupy(tmp_win);
210bbfda8aSnia}
220bbfda8aSnia
230bbfda8aSniaDFHANDLER(occupyall)
240bbfda8aSnia{
250bbfda8aSnia	OccupyAll(tmp_win);
260bbfda8aSnia}
270bbfda8aSnia
280bbfda8aSnia
290bbfda8aSnia/*
300bbfda8aSnia * Selecting a window and passing a specific workspace as the function
310bbfda8aSnia * arg.
320bbfda8aSnia */
330bbfda8aSniaDFHANDLER(addtoworkspace)
340bbfda8aSnia{
350bbfda8aSnia	AddToWorkSpace(action, tmp_win);
360bbfda8aSnia}
370bbfda8aSnia
380bbfda8aSniaDFHANDLER(removefromworkspace)
390bbfda8aSnia{
400bbfda8aSnia	RemoveFromWorkSpace(action, tmp_win);
410bbfda8aSnia}
420bbfda8aSnia
430bbfda8aSniaDFHANDLER(toggleoccupation)
440bbfda8aSnia{
450bbfda8aSnia	ToggleOccupation(action, tmp_win);
460bbfda8aSnia}
470bbfda8aSnia
480bbfda8aSnia
490bbfda8aSnia/*
500bbfda8aSnia * Pushing a window away from / pulling it to "here".
510bbfda8aSnia */
520bbfda8aSniaDFHANDLER(vanish)
530bbfda8aSnia{
540bbfda8aSnia	WMgrRemoveFromCurrentWorkSpace(Scr->currentvs, tmp_win);
550bbfda8aSnia}
560bbfda8aSnia
570bbfda8aSniaDFHANDLER(warphere)
580bbfda8aSnia{
590bbfda8aSnia	WMgrAddToCurrentWorkSpaceAndWarp(Scr->currentvs, action);
600bbfda8aSnia}
610bbfda8aSnia
620bbfda8aSnia
630bbfda8aSnia/*
640bbfda8aSnia * Pushing a window away somewhere and potentially following it.
650bbfda8aSnia */
660bbfda8aSniaDFHANDLER(movetonextworkspace)
670bbfda8aSnia{
680bbfda8aSnia	MoveToNextWorkSpace(Scr->currentvs, tmp_win);
690bbfda8aSnia}
700bbfda8aSnia
710bbfda8aSniaDFHANDLER(movetoprevworkspace)
720bbfda8aSnia{
730bbfda8aSnia	MoveToPrevWorkSpace(Scr->currentvs, tmp_win);
740bbfda8aSnia}
750bbfda8aSnia
760bbfda8aSniaDFHANDLER(movetonextworkspaceandfollow)
770bbfda8aSnia{
780bbfda8aSnia	MoveToNextWorkSpaceAndFollow(Scr->currentvs, tmp_win);
790bbfda8aSnia}
800bbfda8aSnia
810bbfda8aSniaDFHANDLER(movetoprevworkspaceandfollow)
820bbfda8aSnia{
830bbfda8aSnia	MoveToPrevWorkSpaceAndFollow(Scr->currentvs, tmp_win);
840bbfda8aSnia}
850bbfda8aSnia
860bbfda8aSnia
870bbfda8aSnia
880bbfda8aSnia/*
890bbfda8aSnia * Switching to other workspaces.
900bbfda8aSnia */
910bbfda8aSniaDFHANDLER(gotoworkspace)
920bbfda8aSnia{
930bbfda8aSnia	/*
940bbfda8aSnia	 * n.b.: referenced in the Developer Manual in doc/devman/; if you
950bbfda8aSnia	 * make any changes here be sure to tweak that if necessary.
960bbfda8aSnia	 */
970bbfda8aSnia	GotoWorkSpaceByName(Scr->currentvs, action);
980bbfda8aSnia}
990bbfda8aSnia
1000bbfda8aSniaDFHANDLER(prevworkspace)
1010bbfda8aSnia{
1020bbfda8aSnia	GotoPrevWorkSpace(Scr->currentvs);
1030bbfda8aSnia}
1040bbfda8aSnia
1050bbfda8aSniaDFHANDLER(nextworkspace)
1060bbfda8aSnia{
1070bbfda8aSnia	GotoNextWorkSpace(Scr->currentvs);
1080bbfda8aSnia}
1090bbfda8aSnia
1100bbfda8aSniaDFHANDLER(rightworkspace)
1110bbfda8aSnia{
1120bbfda8aSnia	GotoRightWorkSpace(Scr->currentvs);
1130bbfda8aSnia}
1140bbfda8aSnia
1150bbfda8aSniaDFHANDLER(leftworkspace)
1160bbfda8aSnia{
1170bbfda8aSnia	GotoLeftWorkSpace(Scr->currentvs);
1180bbfda8aSnia}
1190bbfda8aSnia
1200bbfda8aSniaDFHANDLER(upworkspace)
1210bbfda8aSnia{
1220bbfda8aSnia	GotoUpWorkSpace(Scr->currentvs);
1230bbfda8aSnia}
1240bbfda8aSnia
1250bbfda8aSniaDFHANDLER(downworkspace)
1260bbfda8aSnia{
1270bbfda8aSnia	GotoDownWorkSpace(Scr->currentvs);
1280bbfda8aSnia}
129