예제 #1
0
파일: workspace.c 프로젝트: jafd/wmaker
void wWorkspaceRelativeChange(WScreen * scr, int amount)
{
	int w;

	/* While the deiconify animation is going on the window is
	 * still "flying" to its final position and we don't want to
	 * change workspace before the animation finishes, otherwise
	 * the window will land in the new workspace */
	if (w_global.workspace.ignore_change)
		return;

	w = w_global.workspace.current + amount;

	if (amount < 0) {
		if (w >= 0) {
			wWorkspaceChange(scr, w);
		} else if (wPreferences.ws_cycle) {
			wWorkspaceChange(scr, w_global.workspace.count + w);
		}
	} else if (amount > 0) {
		if (w < w_global.workspace.count) {
			wWorkspaceChange(scr, w);
		} else if (wPreferences.ws_advance) {
			wWorkspaceChange(scr, WMIN(w, MAX_WORKSPACES - 1));
		} else if (wPreferences.ws_cycle) {
			wWorkspaceChange(scr, w % w_global.workspace.count);
		}
	}
}
예제 #2
0
static void
iconDblClick(WObjDescriptor *desc, XEvent *event)
{
    WAppIcon *aicon = desc->parent;
    WApplication *wapp;
    WScreen *scr = aicon->icon->core->screen_ptr;
    int unhideHere;

    assert(aicon->icon->owner!=NULL);

    wapp = wApplicationOf(aicon->icon->owner->main_window);
#ifdef DEBUG0
    if (!wapp) {
        wwarning("could not find application descriptor for app icon!!");
        return;
    }
#endif

    unhideHere = (event->xbutton.state & ShiftMask);

    /* go to the last workspace that the user worked on the app */
    if (!unhideHere && wapp->last_workspace != scr->current_workspace)
        wWorkspaceChange(scr, wapp->last_workspace);

    wUnhideApplication(wapp, event->xbutton.button==Button2, unhideHere);

    if (event->xbutton.state & MOD_MASK) {
        wHideOtherApplications(aicon->icon->owner);
    }
}
예제 #3
0
파일: workspace.c 프로젝트: jafd/wmaker
static void lastWSCommand(WMenu *menu, WMenuEntry *entry)
{
	/* Parameter not used, but tell the compiler that it is ok */
	(void) entry;

	wWorkspaceChange(menu->frame->screen_ptr, w_global.workspace.last_used);
}
예제 #4
0
파일: appicon.c 프로젝트: awmaker/awmaker
static void iconDblClick(WObjDescriptor *desc, XEvent *event)
{
	WAppIcon *aicon = desc->parent;
	WApplication *wapp;
	virtual_screen *vscr = aicon->icon->vscr;
	int unhideHere;

	assert(aicon->icon->owner != NULL);

	wapp = wApplicationOf(aicon->icon->owner->main_window);

	if (event->xbutton.state & ControlMask) {
		relaunchApplication(wapp);
		return;
	}

	unhideHere = (event->xbutton.state & ShiftMask);
	/* go to the last workspace that the user worked on the app */
	if (!unhideHere && wapp->last_workspace != vscr->workspace.current)
		wWorkspaceChange(vscr, wapp->last_workspace);

	wUnhideApplication(wapp, event->xbutton.button == Button2, unhideHere);

	if (event->xbutton.state & MOD_MASK)
		wHideOtherApplications(aicon->icon->owner);
}
예제 #5
0
파일: appicon.c 프로젝트: awmaker/awmaker
static void hideCallback(WMenu *menu, WMenuEntry *entry)
{
	WApplication *wapp = (WApplication *) entry->clientdata;

	if (wapp->flags.hidden) {
		wWorkspaceChange(menu->vscr, wapp->last_workspace);
		wUnhideApplication(wapp, False, False);
	} else {
		wHideApplication(wapp);
	}
}
예제 #6
0
파일: workspace.c 프로젝트: jafd/wmaker
static void newWSCommand(WMenu *menu, WMenuEntry *foo)
{
	int ws;

	/* Parameter not used, but tell the compiler that it is ok */
	(void) foo;

	ws = wWorkspaceNew(menu->frame->screen_ptr);

	/* autochange workspace */
	if (ws >= 0)
		wWorkspaceChange(menu->frame->screen_ptr, ws);
}
예제 #7
0
파일: workspace.c 프로젝트: jafd/wmaker
static void switchWSCommand(WMenu * menu, WMenuEntry * entry)
{
	wWorkspaceChange(menu->frame->screen_ptr, (long)entry->clientdata);
}
예제 #8
0
파일: workspace.c 프로젝트: jafd/wmaker
Bool wWorkspaceDelete(WScreen * scr, int workspace)
{
	WWindow *tmp;
	WWorkspace **list;
	int i, j;

	if (workspace <= 0)
		return False;

	/* verify if workspace is in use by some window */
	tmp = scr->focused_window;
	while (tmp) {
		if (!IS_OMNIPRESENT(tmp) && tmp->frame->workspace == workspace)
			return False;
		tmp = tmp->prev;
	}

	if (!wPreferences.flags.noclip) {
		wDockDestroy(w_global.workspace.array[workspace]->clip);
		w_global.workspace.array[workspace]->clip = NULL;
	}

	list = wmalloc(sizeof(WWorkspace *) * (w_global.workspace.count - 1));
	j = 0;
	for (i = 0; i < w_global.workspace.count; i++) {
		if (i != workspace) {
			list[j++] = w_global.workspace.array[i];
		} else {
			if (w_global.workspace.array[i]->name)
				wfree(w_global.workspace.array[i]->name);
			wfree(w_global.workspace.array[i]);
		}
	}
	wfree(w_global.workspace.array);
	w_global.workspace.array = list;

	w_global.workspace.count--;

	/* update menu */
	wWorkspaceMenuUpdate(w_global.workspace.menu);
	/* clip workspace menu */
	wWorkspaceMenuUpdate(w_global.clip.ws_menu);

	/* update also window menu */
	if (w_global.workspace.submenu) {
		WMenu *menu = w_global.workspace.submenu;

		i = menu->entry_no;
		while (i > w_global.workspace.count)
			wMenuRemoveItem(menu, --i);
		wMenuRealize(menu);
	}
	/* and clip menu */
	if (w_global.clip.submenu) {
		WMenu *menu = w_global.clip.submenu;

		i = menu->entry_no;
		while (i > w_global.workspace.count)
			wMenuRemoveItem(menu, --i);
		wMenuRealize(menu);
	}
	wNETWMUpdateDesktop(scr);
	WMPostNotificationName(WMNWorkspaceDestroyed, scr, (void *)(uintptr_t) (w_global.workspace.count - 1));

	if (w_global.workspace.current >= w_global.workspace.count)
		wWorkspaceChange(scr, w_global.workspace.count - 1);
	if (w_global.workspace.last_used >= w_global.workspace.count)
		w_global.workspace.last_used = 0;

	return True;
}