gboolean activate = FALSE;
ObAppSettings *settings;
gboolean transient = FALSE;
- Rect place, *monitor, *allmonitors;
+ Rect place;
+ Rect const *monitor, *allmonitors;
Time launch_time, map_time;
guint32 user_time;
gboolean obplaced;
client_apply_startup_state(self, place.x, place.y,
place.width, place.height);
- g_free(monitor);
monitor = NULL;
- g_free(allmonitors);
allmonitors = NULL;
ob_debug_type(OB_DEBUG_FOCUS, "Going to try activate new window? %s",
if (!got &&
OBT_PROP_GETA32(self->window, NET_WM_STRUT, CARDINAL, &data, &num)) {
if (num == 4) {
- Rect *a;
+ Rect const *a;
got = TRUE;
a->x, a->x + a->width - 1,
a->y, a->y + a->height - 1,
a->x, a->x + a->width - 1);
- g_free(a);
}
g_free(data);
}
static ObStackingLayer calc_layer(ObClient *self)
{
ObStackingLayer l;
- Rect *monitor, *allmonitors;
+ Rect const *monitor, *allmonitors;
monitor = screen_physical_area_monitor(client_monitor(self));
allmonitors = screen_physical_area_all_monitors();
else if (self->below) l = OB_STACKING_LAYER_BELOW;
else l = OB_STACKING_LAYER_NORMAL;
- g_free(monitor);
- g_free(allmonitors);
-
return l;
}
/* set the size and position if fullscreen */
if (self->fullscreen) {
- Rect *a;
+ Rect const *a;
guint i;
i = screen_find_monitor(&desired);
user = FALSE; /* ignore if the client can't be moved/resized when it
is fullscreening */
-
- g_free(a);
} else if (self->max_horz || self->max_vert) {
Rect *a;
guint i;
gint gravity;
gint l, r, t, b;
gint strw, strh;
- Rect *a;
+ Rect const *a;
gint hidesize;
RrMargins(dock->a_frame, &l, &t, &r, &b);
}
screen_update_areas();
-
- g_free(a);
}
void dock_app_configure(ObDockApp *app, gint w, gint h)
gint ml, mt, mr, mb;
gint l, t, r, b;
gint x, y, w, h;
- Rect *screen_area = NULL;
+ Rect const *screen_area = NULL;
gint i;
GList *it;
const ObFocusCyclePopupTarget *newtarget;
p->last_target = newtarget;
- g_free(screen_area);
-
XFlush(obt_display);
}
/* do this stuff only when the dialog is first showing */
if (!popup.mapped) {
- Rect *a;
+ Rect const *a;
popup_setup(&popup, FALSE, FALSE);
g_assert(popup.targets == NULL);
icon_popup_min_width(single_popup, POPUP_WIDTH);
icon_popup_max_width(single_popup, MAX(a->width/3, POPUP_WIDTH));
icon_popup_text_width(single_popup, popup.maxtextw);
- g_free(a);
}
text = popup_get_name(c);
if (self->client->icon_geometry.width == 0) {
/* there is no icon geometry set so just go straight down */
- Rect *a = screen_physical_area_monitor
- (screen_find_monitor(&self->area));
+ Rect const *a = screen_physical_area_monitor(screen_find_monitor(&self->area));
iconx = self->area.x + self->area.width / 2 + 32;
icony = a->y + a->width;
iconw = 64;
- g_free(a);
} else {
iconx = self->client->icon_geometry.x;
icony = self->client->icon_geometry.y;
if (curpos != NULL) {
gchar *text = NULL;
GList *it;
- Rect *a;
+ Rect const *a;
for (it = curpos->keylist; it; it = g_list_next(it)) {
gchar *oldtext = text;
/* 1 second delay for the popup to show */
popup_delay_show(popup, G_USEC_PER_SEC, text);
g_free(text);
- g_free(a);
} else {
popup_hide(popup);
}
void menu_frame_move_on_screen(ObMenuFrame *self, gint x, gint y,
gint *dx, gint *dy)
{
- Rect *a = NULL;
+ Rect const *a = NULL;
gint pos, half;
*dx = *dy = 0;
*dx = MAX(*dx, a->x - x);
*dy = MAX(*dy, a->y - y);
}
-
- g_free(a);
}
static void menu_entry_frame_render(ObMenuEntryFrame *self)
static void menu_frame_update(ObMenuFrame *self)
{
GList *mit, *fit;
- Rect *a;
+ Rect const *a;
gint h;
menu_pipe_execute(self->menu);
}
}
- g_free(a);
-
menu_frame_render(self);
}
c->frame->area.x + c->frame->area.width / 2,
c->frame->area.y + c->frame->area.height / 2);
else /* Fixed */ {
- Rect *area = screen_physical_area_active();
+ Rect const *area = screen_physical_area_active();
gint gravity, x, y;
x = config_resize_popup_fixed.x.pos;
}
popup_position(popup, gravity, x, y);
-
- g_free(area);
}
popup_show(popup, text);
g_free(text);
dir = -1;
for (i = 0; i < screen_num_monitors; ++i) {
- Rect *a = screen_physical_area_monitor(i);
+ Rect const *a = screen_physical_area_monitor(i);
if (x == RECT_LEFT(*a)) dir = OB_DIRECTION_WEST;
if (x == RECT_RIGHT(*a)) dir = OB_DIRECTION_EAST;
if (y == RECT_TOP(*a)) dir = OB_DIRECTION_NORTH;
{
dir = -1;
}
- g_free(a);
}
if (dir != edge_warp_dir) {
screen_pointer_pos(&px, &py);
for (i = 0; i < screen_num_monitors; i++) {
- Rect *monitor = screen_physical_area_monitor(i);
+ Rect const *monitor = screen_physical_area_monitor(i);
gboolean contain = RECT_CONTAINS(*monitor, px, py);
- g_free(monitor);
if (contain) {
add_choice(choice, i);
ob_debug("placement adding choice %d for mouse pointer", i);
gint emptyx, emptyy; /* empty space between elements */
gint textx, texty, textw, texth;
gint iconx, icony, iconw, iconh;
- Rect *area, mon;
+ Rect const *area;
+ Rect mon;
gboolean hasicon = self->hasicon;
/* when there is no icon and the text is not parent relative, then
x=MAX(MIN(x, area->x+area->width-w),area->x);
y=MAX(MIN(y, area->y+area->height-h),area->y);
- g_free(area);
-
if (m == screen_num_monitors) {
RECT_SET(mon, x, y, w, h);
m = screen_find_monitor(&mon);
x=MAX(MIN(x, area->x+area->width-w),area->x);
y=MAX(MIN(y, area->y+area->height-h),area->y);
-
- g_free(area);
}
/* set the windows/appearances up */
b += OUTSIDE_MARGIN;
{
- Rect *area = screen_physical_area_all_monitors();
+ Rect const *area = screen_physical_area_all_monitors();
maxw = MIN(MAX_WIDTH, area->width*4/5);
- g_free(area);
}
/* find the button sizes and how much space we need for them */
void resist_move_monitors(ObClient *c, gint resist, gint *x, gint *y)
{
- Rect *area, *parea;
+ Rect *area;
+ Rect const *parea;
guint i;
gint l, t, r, b; /* requested edges */
gint al, at, ar, ab; /* screen area edges */
for (i = 0; i < screen_num_monitors; ++i) {
parea = screen_physical_area_monitor(i);
- if (!RECT_INTERSECTS_RECT(*parea, c->frame->area)) {
- g_free(parea);
+ if (!RECT_INTERSECTS_RECT(*parea, c->frame->area))
continue;
- }
area = screen_area(c->desktop, SCREEN_AREA_ALL_MONITORS,
&desired_area);
*y = pb - h + 1;
g_slice_free(Rect, area);
- g_free(parea);
}
frame_frame_gravity(c->frame, x, y);
{
gint l, t, r, b; /* my left, top, right and bottom sides */
gint dlt, drb; /* my destination left/top and right/bottom sides */
- Rect *area, *parea;
+ Rect *area;
+ Rect const *parea;
gint al, at, ar, ab; /* screen boundaries */
gint pl, pt, pr, pb; /* physical screen boundaries */
guint i;
for (i = 0; i < screen_num_monitors; ++i) {
parea = screen_physical_area_monitor(i);
- if (!RECT_INTERSECTS_RECT(*parea, c->frame->area)) {
- g_free(parea);
+ if (!RECT_INTERSECTS_RECT(*parea, c->frame->area))
continue;
- }
area = screen_area(c->desktop, SCREEN_AREA_ALL_MONITORS,
&desired_area);
}
g_slice_free(Rect, area);
- g_free(parea);
}
}
void screen_show_desktop_popup(guint d, gboolean perm)
{
- Rect *a;
+ Rect const *a;
/* 0 means don't show the popup */
if (!config_desktop_popup_time) return;
g_direct_equal, NULL);
if (perm)
desktop_popup_perm = TRUE;
-
- g_free(a);
}
void screen_hide_desktop_popup(void)
guint mostv = 0;
for (i = 0; i < screen_num_monitors; ++i) {
- Rect *area = screen_physical_area_monitor(i);
+ Rect const *area = screen_physical_area_monitor(i);
if (RECT_INTERSECTS_RECT(*area, *search)) {
Rect r;
guint v;
most = i;
}
}
- g_free(area);
}
return most;
}
-Rect* screen_physical_area_all_monitors(void)
+Rect const* screen_physical_area_all_monitors(void)
{
return screen_physical_area_monitor(screen_num_monitors);
}
-Rect* screen_physical_area_monitor(guint head)
+Rect const* screen_physical_area_monitor(guint head)
{
- Rect *a;
g_assert(head <= screen_num_monitors);
- a = g_new(Rect, 1);
- *a = monitor_area[head];
- return a;
+ return &monitor_area[head];
}
gboolean screen_physical_area_monitor_contains(guint head, Rect *search)
return screen_monitor_pointer();
}
-Rect* screen_physical_area_active(void)
+Rect const* screen_physical_area_active(void)
{
return screen_physical_area_monitor(screen_monitor_active());
}
return screen_monitor_pointer();
}
-Rect *screen_physical_area_primary(gboolean fixed)
+Rect const *screen_physical_area_primary(gboolean fixed)
{
return screen_physical_area_monitor(screen_monitor_primary(fixed));
}
void screen_update_areas(void);
-Rect *screen_physical_area_all_monitors(void);
+Rect const* screen_physical_area_all_monitors(void);
-Rect *screen_physical_area_monitor(guint head);
+/*! Returns a Rect which is owned by the screen code and should not be freed */
+Rect const* screen_physical_area_monitor(guint head);
/*! Returns the monitor which contains the active window, or the one
containing the pointer otherwise. */
guint screen_monitor_active(void);
-Rect *screen_physical_area_active(void);
+/*! Returns a Rect which is owned by the screen code and should not be freed */
+Rect const* screen_physical_area_active(void);
/*! Returns the primary monitor, as specified by the config.
@fixed If TRUE, then this will always return a fixed monitor, otherwise
@fixed If TRUE, then this will always use a fixed monitor as primary,
otherwise it may change based on where focus is, or other heuristics.
See screen_monitor_primary().
+ @return A Rect which is owned by the screen code and should not be freed
*/
-Rect *screen_physical_area_primary(gboolean fixed);
+Rect const *screen_physical_area_primary(gboolean fixed);
/* doesn't include struts which the search area is already outside of when
'search' is not NULL */