void LLContainerView::reshape(S32 width, S32 height, BOOL called_from_parent)
{
	LLRect scroller_rect;
	scroller_rect.setOriginAndSize(0, 0, width, height);

	if (mScrollContainer)
	{
		scroller_rect = mScrollContainer->getContentWindowRect();
	}
	else
	{
		// if we're uncontained - make height as small as possible
		scroller_rect.mTop = 0;
	}

	arrange(scroller_rect.getWidth(), scroller_rect.getHeight(), called_from_parent);

	// sometimes, after layout, our container will change size (scrollbars popping in and out)
	// if so, attempt another layout
	if (mScrollContainer)
	{
		LLRect new_container_rect = mScrollContainer->getContentWindowRect();

		if ((new_container_rect.getWidth() != scroller_rect.getWidth()) ||
			(new_container_rect.getHeight() != scroller_rect.getHeight()))  // the container size has changed, attempt to arrange again
		{
			arrange(new_container_rect.getWidth(), new_container_rect.getHeight(), called_from_parent);
		}
	}
}
Exemplo n.º 2
0
/** Move a client from one tag to another with dah mouse
 *\param c client pointer
 */
static void
mouse_move_tag_client(Client *c)
{
     Window w;
     int i, d, s;

     if(!(c->flags & TileFlag) && !(c->flags & LMaxFlag))
          return;

     s = c->screen;

     XQueryPointer(dpy, infobar[selscreen].tags_board->win, &w, &w, &d, &d, &d, &d, (uint*)&d);

     for(i = 1; i < conf.ntag[selscreen] + 1; ++i)
          if(infobar[selscreen].tags[i]->win == w
             && tags[selscreen][i].layout.func != freelayout)
          {
               c->screen = selscreen;
               c->tag = i;
               tags[c->screen][c->tag].request_update = True;
               arrange(s, True);

               if(s != c->screen)
                    arrange(c->screen, True);
          }

     client_focus_next(c);

     return;
}
Exemplo n.º 3
0
void
toggleview(View *cv, int index)
{
	Client *c;
	View *v;
	unsigned long long tags;
	unsigned i;

	/* Typically from a keyboard command.  Again, we should use the monitor with the
	   keyboard focus before the monitor with the pointer in it. */

	/* This function used to worry about having a selected tag for each monitor, but
	   this has now been moved to the view.  We don't care if there exists views that
	   have no selected tag because they can still be assigned to a monitor and tags
	   toggled from there. */
	if (-1 > index || index >= scr->ntags)
		return;
	tags = (index == -1) ? ((1ULL << scr->ntags) - 1) : (1ULL << index);
	cv->seltags ^= tags;
	for (v = scr->views, i = 0; i < scr->ntags; i++, v++)
		if ((v->seltags & tags) && v != cv)
			arrange(v);
	arrange(cv);
	c = lastselected(cv);
	focus(c);
	focuslockclient(c);
	ewmh_update_net_current_desktop();
}
void LLContainerView::reshape(S32 width, S32 height, BOOL called_from_parent)
{
	S32 desired_width = width;
	S32 desired_height = height;

	if (mScrollContainer)
	{
		BOOL dum_bool;
		mScrollContainer->calcVisibleSize(&desired_width, &desired_height, &dum_bool, &dum_bool);
	}
	else
	{
		// if we're uncontained - make height as small as possible
		desired_height = 0;
	}

	arrange(desired_width, desired_height, called_from_parent);

	// sometimes, after layout, our container will change size (scrollbars popping in and out)
	// if so, attempt another layout
	if (mScrollContainer)
	{
		S32 new_container_width;
		S32 new_container_height;
		BOOL dum_bool;
		mScrollContainer->calcVisibleSize(&new_container_width, &new_container_height, &dum_bool, &dum_bool);

		if ((new_container_width != desired_width) ||
			(new_container_height != desired_height))  // the container size has changed, attempt to arrange again
		{
			arrange(new_container_width, new_container_height, called_from_parent);
		}
	}
}
Exemplo n.º 5
0
void
view(View *ov, int index)
{
	Monitor *cm, *om;
	Client *c;
	View *cv;

	if (!ov) {
		EPRINTF("Null view pointer.\n");
		return;
	}
	if (0 > index || index >= scr->ntags) {
		XPRINTF("WARNING: bad index %d\n", index);
		return;
	}
	if (ov->index == index) {
		XPRINTF("WARNING: view already index %d\n", index);
		return;
	}
	if (!(cm = ov->curmon)) {
		XPRINTF("WARNING: view %d has no monitor\n", ov->index);
		return;
	}
	XPRINTF("VIEW: disassociating monitor %d from view %d\n", cm->num, ov->index);
	ov->curmon = NULL;
	XPRINTF("VIEW: setting previous view for monitor %d to view %d\n", cm->num, ov->index);
	cm->preview = ov;
	XPRINTF("VIEW: new view is %d\n", index);
	cv = scr->views + index;
	XPRINTF("VIEW: associating monitor %d with view %d\n", cm->num, cv->index);
	cv->curmon = cm;
	XPRINTF("VIEW: associating view %d with monitor %d\n", cv->index, cm->num);
	cm->curview = cv;
	for (om = scr->monitors; om; om = om->next) {
		if (om == cm)
			continue;
		if (om->curview == cv) {
			XPRINTF("VIEW: switching monitor %d from view %d to %d\n",
					om->num, om->curview->index, ov->index);
			om->curview = ov;
			ov->curmon = om;
			updategeom(om);
			XPRINTF("VIEW: arranging view %d\n", ov->index);
			arrange(ov);
			/* only one can match */
			break;
		}
	}
	updategeom(cm);
	XPRINTF("VIEW: arranging view %d\n", cv->index);
	arrange(cv);
	c = lastselected(cv);
	focus(c);
	focuslockclient(c);
	ewmh_update_net_current_desktop();
}
void MainMenu::draw() {
	ofSetHexColor(0xFFFFFF);


	arrange();
	
	if(!touching) {
		
		// pulling the top
		if(scrollOffset>0) {
			deltaX = -scrollOffset*0.1;
			
			
			// pulling the bottom
			// 
		} else if(totalWidth + scrollOffset < scrollRect.width) {
			
			deltaX = (scrollRect.width - (totalWidth + scrollOffset))*0.1;
		
		} else {
			// normal momentum
			deltaX *= 0.9;
			
		}
		if(ABS(deltaX)<1) deltaX = 0;
		scrollOffset += deltaX;
	}
	
	
	Container::draw();	

	
}
Exemplo n.º 7
0
 void MusicModel::arrange(int silenceInstrumentNumber,
                          std::string csoundInstrumentName, double gain, double pan)
 {
   int csoundInstrumentNumber =
     cppSound->getInstrumentNumber(csoundInstrumentName);
   arrange(silenceInstrumentNumber, csoundInstrumentNumber, gain, pan);
 }
Exemplo n.º 8
0
 void MusicModel::arrange(int silenceInstrumentNumber,
                          std::string csoundInstrumentName)
 {
   int csoundInstrumentNumber =
     cppSound->getInstrumentNumber(csoundInstrumentName);
   arrange(silenceInstrumentNumber, csoundInstrumentNumber);
 }
Exemplo n.º 9
0
Arquivo: infobar.c Projeto: n4cht/nnwm
/* Set the infobar position
 * \param pos Position of the bar
 */
void
infobar_set_position(int pos)
{
     screen_get_sel();

     switch(pos)
     {
     case IB_Hide:
          sgeo[selscreen].y = spgeo[selscreen].y + TBARH;
          sgeo[selscreen].height = spgeo[selscreen].height - TBARH;
          infobar[selscreen].geo.y = -(infobar[selscreen].geo.height) * 2;
          break;
     case IB_Bottom:
          sgeo[selscreen].y = spgeo[selscreen].y + TBARH;
          sgeo[selscreen].height = spgeo[selscreen].height - INFOBARH - TBARH;
          infobar[selscreen].geo.y = spgeo[selscreen].y + sgeo[selscreen].height + TBARH;
          break;
     default:
     case IB_Top:
          sgeo[selscreen].y = spgeo[selscreen].y + INFOBARH + TBARH;
          sgeo[selscreen].height = spgeo[selscreen].height - INFOBARH - TBARH;
          infobar[selscreen].geo.y = spgeo[selscreen].y;
          break;
     }

     tags[selscreen][seltag[selscreen]].barpos = pos;

     barwin_move(infobar[selscreen].bar, sgeo[selscreen].x - BORDH, infobar[selscreen].geo.y);
     infobar_draw(selscreen);
     arrange(selscreen, True);

     return;
}
Exemplo n.º 10
0
void handle_state(monitor_t *m, desktop_t *d, node_t *n, xcb_atom_t state, unsigned int action)
{
	if (state == ewmh->_NET_WM_STATE_FULLSCREEN) {
		if (action == XCB_EWMH_WM_STATE_ADD)
			set_fullscreen(n, true);
		else if (action == XCB_EWMH_WM_STATE_REMOVE)
			set_fullscreen(n, false);
		else if (action == XCB_EWMH_WM_STATE_TOGGLE)
			set_fullscreen(n, !n->client->fullscreen);
		arrange(m, d);
	} else if (state == ewmh->_NET_WM_STATE_STICKY) {
		if (action == XCB_EWMH_WM_STATE_ADD)
			set_sticky(m, d, n, true);
		else if (action == XCB_EWMH_WM_STATE_REMOVE)
			set_sticky(m, d, n, false);
		else if (action == XCB_EWMH_WM_STATE_TOGGLE)
			set_sticky(m, d, n, !n->client->sticky);
	} else if (state == ewmh->_NET_WM_STATE_DEMANDS_ATTENTION) {
		if (action == XCB_EWMH_WM_STATE_ADD)
			set_urgency(m, d, n, true);
		else if (action == XCB_EWMH_WM_STATE_REMOVE)
			set_urgency(m, d, n, false);
		else if (action == XCB_EWMH_WM_STATE_TOGGLE)
			set_urgency(m, d, n, !n->client->urgent);
	}
}
Exemplo n.º 11
0
void
ewmh_process_state_atom(Client *c, Atom state, int set) {
	CARD32 data[2];

	data[1] = None;
	if (state == atom[WindowStateFs]) {
		focus(c);
		if ((set == _NET_WM_STATE_ADD || set == _NET_WM_STATE_TOGGLE)
				&& !c->ismax) {
			c->wasfloating = c->isfloating;
			if (!c->isfloating)
				togglefloating(NULL);
			togglemax(NULL);
			data[0] = state;
		} else if ((set == _NET_WM_STATE_REMOVE ||
				set == _NET_WM_STATE_TOGGLE) && c->ismax) {
			togglemax(NULL);
			if (!c->wasfloating)
				togglefloating(NULL);
			data[0] = None;
		}
		XChangeProperty(dpy, c->win, atom[WindowState], XA_ATOM, 32,
		    PropModeReplace, (unsigned char *) data, 2);
		DPRINT;
		arrange(curmonitor());
		DPRINTF("%s: x%d y%d w%d h%d\n", c->name, c->x, c->y, c->w, c->h);
	}
	if (state == atom[WindowStateModal])
		focus(c);
}
Exemplo n.º 12
0
void
clientmessage(XEvent *e) {
	XClientMessageEvent *ev = &e->xclient;
	Client *c;

	if (ev->message_type == atom[CloseWindow]) {
		if ((c = getclient(ev->window, clients, ClientWindow)))
			killclient(c);
	}
	else if (ev->message_type == atom[ActiveWindow]) {
		if ((c = getclient(ev->window, clients, ClientWindow))) {
				c->isicon = False;
				focus(c);
				arrange(curmonitor());
		}
	} else if (ev->message_type == atom[CurDesk]) {
		view(tags[ev->data.l[0]]);
	} else if (ev->message_type == atom[WindowState]) {
		if ((c = getclient(ev->window, clients, ClientWindow))) {
			ewmh_process_state_atom(c, (Atom) ev->data.l[1], ev->data.l[0]);
			if (ev->data.l[2])
				ewmh_process_state_atom(c,
				    (Atom) ev->data.l[2], ev->data.l[0]);
		}
	} else if (ev->message_type == atom[WMChangeState]) {
		if ((c = getclient(ev->window, clients, ClientWindow))) {
			if (ev->data.l[0] == IconicState) {
				focus(c);
				iconify(NULL);
			}
		}
	}
}
/* Drier program to test above function */
int main(void)
{
    struct node *list1 = NULL, *list3 = NULL;
    list1 = create(list1);
    list3 = arrange(&list1);
    display(list3);
}
Exemplo n.º 14
0
void
cyclelayout() {
	lt[sellt]++; 
	if (lt[sellt] == layouts + LENGTH(layouts)) lt[sellt] = layouts;
	if(sel) arrange();
	else drawbar();
}
Exemplo n.º 15
0
Arquivo: tag.c Projeto: wavebeem/wmfs
/* Transfert a client to a tag
 * \param c Client pointer
 * \param tag Tag
*/
void
tag_transfert(Client *c, int tag)
{
     screen_get_sel();

     CHECK(c);

     if(tag <= 0)
          tag = 1;

     if(tag > conf.ntag[selscreen])
          return;

     c->tag = tag;
     c->screen = selscreen;

     arrange(c->screen, True);

     client_focus_next(c);

     client_update_attributes(c);

     tags[c->screen][tag].request_update = True;

     return;
}
Exemplo n.º 16
0
void transfer_desktop(monitor_t *ms, monitor_t *md, desktop_t *d)
{
	if (ms == md)
		return;

	desktop_t *dd = ms->desk;
	unlink_desktop(ms, d);
	insert_desktop(md, d);

	if (d == dd) {
		if (ms->desk != NULL)
			show_desktop(ms->desk);
		if (md->desk != d)
			hide_desktop(d);
	}

	for (node_t *n = first_extrema(d->root); n != NULL; n = next_leaf(n, d->root))
		translate_client(ms, md, n->client);

	arrange(md, d);

	if (d != dd && md->desk == d)
		show_desktop(d);

	history_transfer_desktop(md, d);

	ewmh_update_wm_desktops();
	ewmh_update_desktop_names();
	ewmh_update_current_desktop();
	put_status();
}
Exemplo n.º 17
0
Arquivo: monitor.c Projeto: dj95/bspwm
void update_root(monitor_t *m, xcb_rectangle_t *rect)
{
	xcb_rectangle_t last_rect = m->rectangle;
	m->rectangle = *rect;
	if (m->root == XCB_NONE) {
		uint32_t values[] = {XCB_EVENT_MASK_ENTER_WINDOW};
		m->root = xcb_generate_id(dpy);
		xcb_create_window(dpy, XCB_COPY_FROM_PARENT, m->root, root,
		                  rect->x, rect->y, rect->width, rect->height, 0,
		                  XCB_WINDOW_CLASS_INPUT_ONLY, XCB_COPY_FROM_PARENT, XCB_CW_EVENT_MASK, values);
		xcb_icccm_set_wm_class(dpy, m->root, sizeof(ROOT_WINDOW_IC), ROOT_WINDOW_IC);
		window_lower(m->root);
		if (focus_follows_pointer) {
			window_show(m->root);
		}
	} else {
		window_move_resize(m->root, rect->x, rect->y, rect->width, rect->height);
		put_status(SBSC_MASK_MONITOR_GEOMETRY, "monitor_geometry 0x%08X %ux%u+%i+%i\n",
		           m->id, rect->width, rect->height, rect->x, rect->y);
	}
	for (desktop_t *d = m->desk_head; d != NULL; d = d->next) {
		for (node_t *n = first_extrema(d->root); n != NULL; n = next_leaf(n, d->root)) {
			if (n->client == NULL) {
				continue;
			}
			adapt_geometry(&last_rect, rect, n);
		}
		arrange(m, d);
	}
}
Exemplo n.º 18
0
static void
setnmaster(const Arg *arg) {
	if(!arg || !selmon->lt[selmon->sellt]->arrange || selmon->num >= MaxMon)
		return;
	selmon->nmaster[selmon->curtag]= arg->i > 0 ? arg->i : 0;
	arrange(selmon);
}
Exemplo n.º 19
0
void
togglefullscreen(const Arg *arg) {
	Client *c = selmon->sel;

	if(!c)
		return;
	if(!c->isfullscreen) {
		XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
		                PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
		c->isfullscreen = True;
		c->oldstate = c->isfloating;
		c->oldbw = c->bw;
		c->bw = 0;
		c->isfloating = True;
		resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
		XRaiseWindow(dpy, c->win);
	}
	else
	{
		XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
		                PropModeReplace, (unsigned char*)0, 0);
		c->isfullscreen = False;
		c->isfloating = c->oldstate;
		c->bw = c->oldbw;
		c->x = c->oldx;
		c->y = c->oldy;
		c->w = c->oldw;
		c->h = c->oldh;
		resizeclient(c, c->x, c->y, c->w, c->h);
		arrange(c->mon);
	}
}
Exemplo n.º 20
0
void
rotatemonitor(const Arg* arg) {
	Monitor *m, *nextm, *lastm, *sparem = createmon();
	Bool allviews = (arg->i != 0);
	const ViewStack *vs;
	const unsigned int views = allviews ? ~0 : selmon->vs->tagset;
	int i;

	rotatingMons = True;
	/* rotate clients */
	for(m = mons, nextm = mons->next; nextm; m = m->next, nextm = nextm->next) {
		if (!nextm)
			nextm = mons;
		swapmonitors(views, m, nextm, sparem);
	}
	free(sparem);
	/* tidy monitors (num, tagset, lt) */
	for(lastm = mons; lastm && lastm->next; lastm = lastm->next) ;
	for (i = 0, m = mons; m; m = m->next, ++i) {
		m->num = i;
		if(!allviews) {
			if (hasclientson(m, views)) {
				monview(m, views);
				vs = getviewstackof(lastm, views);
				copyviewstack(m->vs, vs);
			}
			else if (!hasclientson(m, m->vs->tagset))
				monview(m, 0);
		}
		restorebar(m);
		arrange(m);
		lastm = m;
	}
	rotatingMons = False;
}
Exemplo n.º 21
0
void doSelection()
{
	int i, j;
	sortRails(0, nr - 1);
	for (i = 0; i < nb; i++)
		board_remainders[i] = board_lengths[i];

	for (i = 0; i < nr; i++)
	{  j = 0;
		while (j < nb && rail_boards[i] == -1)
		{	if (board_remainders[j] >= rail_lengths[i])
			{	rail_boards[i] = j;  board_remainders[j] -= rail_lengths[i]; }
			j++;
		}
		if (rail_boards[i] == -1)
		{	ir = i;
			goto doneForNow;
		}
	}
	ir = i;
   return;
	doneForNow:
	;

	while (arrange())
	{
		j = 0;
		while (j < nb && rail_boards[ir] == -1)
		{	if (board_remainders[j] >= rail_lengths[ir])
			{	rail_boards[ir] = j;  board_remainders[j] -= rail_lengths[ir]; }
			j++;
		}
		ir++;
	}
}
Exemplo n.º 22
0
void change_layout(monitor_t *m, desktop_t *d, layout_t l)
{
	d->layout = l;
	arrange(m, d);
	if (d == mon->desk)
		put_status();
}
Exemplo n.º 23
0
Arquivo: tag.c Projeto: wavebeem/wmfs
/** Keep that tag the last one
  *\param cmd uicb_t type unused
*/
void
uicb_tag_stay_last(uicb_t cmd)
{
     (void)cmd;

     screen_get_sel();

     if(tags[selscreen][seltag[selscreen]].stay_last)
          tags[selscreen][seltag[selscreen]].stay_last = False;

     else
     {
          int i;
          remove_old_last_tag(selscreen);
          
          for(i = seltag[selscreen]; i <= conf.ntag[selscreen]; i++)
          {
               tag_swap(selscreen, seltag[selscreen], seltag[selscreen] + 1);
          }

          tag_set(conf.ntag[selscreen]);
          tags[selscreen][seltag[selscreen]].stay_last = True;
          arrange(selscreen, True);
     }


     return;
}
Exemplo n.º 24
0
void main(){
	LinkList  La;
	LinkList  Lb=NULL;
	build(La);
	output(La);
	Lb=arrange(La);
	output(Lb);
}
Exemplo n.º 25
0
void RoomThread1v1::startArrange(ServerPlayer *player){
    if(player->getState() != "online"){        
        GeneralSelector *selector = GeneralSelector::GetInstance();
        arrange(player, selector->arrange1v1(player));
    }else{
        player->invoke("startArrange");
    }
}
Exemplo n.º 26
0
void
uicb_tag_toggle_expose(uicb_t cmd)
{
     (void)cmd;
     int i, j;

     screen_get_sel();

     for(i = 1; i <= conf.ntag[selscreen]; i++)
     {
          if(strcmp(tags[selscreen][i].name, conf.tag_expose_name) == 0)
          {
               if(clients && sel->tag)
                    tag_set(sel->tag);

               tag_delete(selscreen, i);

               for(j = 0; j < conf.ntag[selscreen]; j++)
                    tags[selscreen][j].request_update = True;

               arrange(selscreen, True);

               return;
          }
     }
     
     tag_new(selscreen, conf.tag_expose_name);

     for(i = 0; i < conf.nlayout; ++i)
     {
          if(strcmp(conf.expose_layout, conf.layout[i].type) == 0)
          {
               tags[selscreen][conf.ntag[selscreen]].layout = conf.layout[i];
          }
     }

     for(i = 1; i < conf.ntag[selscreen]; ++i)
     {
          tags[selscreen][conf.ntag[selscreen]].tagad ^= TagFlag(i);
     }
     
     tags[selscreen][conf.ntag[selscreen]].request_update = True;
     arrange(selscreen, True);

     return;
}
Exemplo n.º 27
0
Arquivo: view.c Projeto: csimons/cswm
void
detach(Arg *arg) {
    if(!sel)
        return;
    sel->view = !sel->view;
    pop(sel);
    arrange();
}
Exemplo n.º 28
0
deque<string> Query::splitQuery(string inputQuery)
{
	int open = 0;
	deque<string> queryDeq;
	deque<string> keyDeq;
	deque<string> operDeq;
	deque<string> resultDeq;
	string str;
	stringstream ss(inputQuery);

	while (ss >> str)
	{
		if (str == "(")
		{
			open++;
			queryDeq.push_back(str);
		}
		else if (str == ")")
		{
			open--;
			string key = queryDeq.back();
			queryDeq.pop_back();
			while (!queryDeq.empty())
			{
				if (key == "(")
				{
					break;
				}
				else if (key == "AND" || key == "OR")
				{
					operDeq.push_front(key);
				}
				else
				{
					keyDeq.push_front(key);
				}
				key = queryDeq.back();
				queryDeq.pop_back();
			}
			deque<string>tempDeq = arrange(keyDeq, operDeq);
			string tempStr;
			keyDeq.clear();
			operDeq.clear();
			while (!tempDeq.empty())
			{
				tempStr = tempDeq.front();
				tempDeq.pop_front();
				if (tempStr != "*")resultDeq.push_back(tempStr);
			}
			queryDeq.push_back("*");
		}
		else
		{
			queryDeq.push_back(str);
		}
	}
	return resultDeq;
}
Exemplo n.º 29
0
static void
incnmaster(const Arg *arg) {
	if(!arg || !selmon->lt[selmon->sellt]->arrange || selmon->num >= MaxMon)
		return;
	selmon->nmaster[selmon->curtag]+= arg->i;
	if(selmon->nmaster[selmon->curtag]< 0)
		selmon->nmaster[selmon->curtag] = 0;
	arrange(selmon);
}
Exemplo n.º 30
0
int PackedLayout::heightForWidth(int w) const
{
    if (w != mWidthCached)
    {
        mHeightCached = arrange(QRect(0, 0, w, 0), false);
        mWidthCached = w;
    }
    return mHeightCached;
}