Lines Matching defs:self
20 static void _RLayoutFreeNames(RLayout *self);
21 static RAreaList *_RLayoutRecenterVertically(const RLayout *self,
23 static RAreaList *_RLayoutRecenterHorizontally(const RLayout *self,
25 static RAreaList *_RLayoutVerticalIntersect(const RLayout *self,
27 static RAreaList *_RLayoutHorizontalIntersect(const RLayout *self,
78 RLayoutCopyCropped(const RLayout *self, int left_margin, int right_margin,
81 RAreaList *cropped_monitors = RAreaListCopyCropped(self->monitors,
96 _RLayoutFreeNames(RLayout *self)
98 if(self == NULL) {
101 if(self->names != NULL) {
102 free(self->names);
103 self->names = NULL;
112 RLayoutFree(RLayout *self)
114 if(self == NULL) {
118 RAreaListFree(self->monitors);
119 RAreaListFree(self->horiz);
120 RAreaListFree(self->vert);
121 _RLayoutFreeNames(self);
122 free(self);
132 RLayoutSetMonitorsNames(RLayout *self, char **names)
134 _RLayoutFreeNames(self);
135 self->names = names;
136 return self;
159 * left-most self->vert.
162 * winds up being whatever horizontal intersection with self->vert would
172 * self.
174 * \param self Our current monitor layout
178 _RLayoutRecenterVertically(const RLayout *self, const RArea *far_area)
180 RArea big = RAreaListBigArea(self->monitors), tmp;
182 // We assume far_area is outside of self. So it's in one of the
193 // with self->vert will always cover a full vertical stripe. Then
225 return RAreaListIntersect(self->vert, &tmp);
244 * bottom-most self->horiz.
247 * it winds up being whatever vertical intersection with self->horiz
257 * self.
259 * \param self Our current monitor layout
263 _RLayoutRecenterHorizontally(const RLayout *self, const RArea *far_area)
265 RArea big = RAreaListBigArea(self->monitors), tmp;
267 // far_area is outside self, so it's in one of the 3 labelled areas:
299 // And intersect that RArea with self->horiz. This results in a
304 return RAreaListIntersect(self->horiz, &tmp);
334 _RLayoutVerticalIntersect(const RLayout *self, const RArea *area)
336 RAreaList *mit = RAreaListIntersect(self->vert, area);
342 mit = _RLayoutRecenterVertically(self, area);
357 _RLayoutHorizontalIntersect(const RLayout *self, const RArea *area)
359 RAreaList *mit = RAreaListIntersect(self->horiz, area);
365 mit = _RLayoutRecenterHorizontally(self, area);
395 * \param[in] self The monitor layout to work from
401 RLayoutFindTopBottomEdges(const RLayout *self, const RArea *area, int *top,
404 RAreaList *mit = _RLayoutVerticalIntersect(self, area);
419 * Find the bottom of the top stripe of self that area fits into. A
424 RLayoutFindBottomEdge(const RLayout *self, const RArea *area)
427 RLayoutFindTopBottomEdges(self, area, NULL, &min_y2);
433 * Find the top of the bottom stripe of self that area fits into. A
438 RLayoutFindTopEdge(const RLayout *self, const RArea *area)
441 RLayoutFindTopBottomEdges(self, area, &max_y, NULL);
460 * \param[in] self The monitor layout to work from
466 RLayoutFindLeftRightEdges(const RLayout *self, const RArea *area, int *left,
469 RAreaList *mit = _RLayoutHorizontalIntersect(self, area);
484 * Find the left edge of the right-most stripe of self that area fits
489 RLayoutFindLeftEdge(const RLayout *self, const RArea *area)
492 RLayoutFindLeftRightEdges(self, area, &max_x, NULL);
498 * Find the right edge of the left-most stripe of self that area fits
503 RLayoutFindRightEdge(const RLayout *self, const RArea *area)
506 RLayoutFindLeftRightEdges(self, area, NULL, &min_x2);
540 * practice, the RArea's in self are the monitors of the desktop, so this
544 RLayoutGetAreaAtXY(const RLayout *self, int x, int y)
548 RAreaListForeach(self->monitors, _findMonitorByXY, &data);
550 return data.area == NULL ? self->monitors->areas[0] : *data.area;
559 RLayoutGetAreaIndex(const RLayout *self, int index)
561 if(index >= self->monitors->len || index < 0) {
565 return self->monitors->areas[index];
570 * Return the RArea in self with the name given by the string of length
576 RLayoutGetAreaByName(const RLayout *self, const char *name, int len)
578 if(self->names != NULL) {
583 for(int i = 0; i < self->monitors->len
584 && self->names[i] != NULL; i++) {
585 if(strncmp(self->names[i], name, len) == 0) {
586 return self->monitors->areas[i];
645 RLayoutFindMonitorBottomEdge(const RLayout *self, const RArea *area)
649 RAreaListForeach(self->monitors, _findMonitorBottomEdge, &data);
651 return data.found ? data.u.min_y2 : RLayoutFindBottomEdge(self, area);
684 RLayoutFindMonitorTopEdge(const RLayout *self, const RArea *area)
688 RAreaListForeach(self->monitors, _findMonitorTopEdge, &data);
690 return data.found ? data.u.max_y : RLayoutFindTopEdge(self, area);
724 RLayoutFindMonitorLeftEdge(const RLayout *self, const RArea *area)
728 RAreaListForeach(self->monitors, _findMonitorLeftEdge, &data);
730 return data.found ? data.u.max_x : RLayoutFindLeftEdge(self, area);
764 RLayoutFindMonitorRightEdge(const RLayout *self, const RArea *area)
768 RAreaListForeach(self->monitors, _findMonitorRightEdge, &data);
770 return data.found ? data.u.min_x2 : RLayoutFindRightEdge(self, area);
789 RLayoutFullHoriz(const RLayout *self, const RArea *area)
793 RLayoutFindLeftRightEdges(self, area, &max_x, &min_x2);
860 RLayoutFullVert(const RLayout *self, const RArea *area)
864 RLayoutFindTopBottomEdges(self, area, &max_y, &min_y2);
883 RLayoutFull(const RLayout *self, const RArea *area)
889 full_horiz = RLayoutFullHoriz(self, area);
890 full_vert = RLayoutFullVert(self, area);
893 full1 = RLayoutFullVert(self, &full_horiz);
894 full2 = RLayoutFullHoriz(self, &full_vert);
909 RLayoutFullHoriz1(const RLayout *self, const RArea *area)
913 RArea target = RLayoutFull1(self, area);
942 RLayoutFullVert1(const RLayout *self, const RArea *area)
945 RArea target = RLayoutFull1(self, area);
969 * \param self Monitor layout
973 RLayoutFull1(const RLayout *self, const RArea *area)
976 RAreaList *mit = RAreaListIntersect(self->monitors, area);
983 mit = _RLayoutRecenterHorizontally(self, area);
1010 RLayoutBigArea(const RLayout *self)
1012 return RAreaListBigArea(self->monitors);
1020 RLayoutNumMonitors(const RLayout *self)
1022 return self->monitors->len;
1032 RLayoutPrint(const RLayout *self)
1035 RAreaListPrint(self->monitors);
1037 RAreaListPrint(self->horiz);
1039 RAreaListPrint(self->vert);