Browse Source

Merge tag 'upstream/2.8.2'

Upstream version 2.8.2
jessie-backports
Maximiliano Curia 7 years ago
parent
commit
f8f68d91ab
  1. 2
      configure.ac
  2. 27
      src/core/boxes.c
  3. 8
      src/core/keybindings.c
  4. 44
      src/core/screen.c
  5. 42
      src/core/testboxes.c
  6. 39
      src/core/workspace.c
  7. 4
      src/meta/screen.h

2
configure.ac

@ -2,7 +2,7 @@ AC_PREREQ(2.50)
m4_define([muffin_major_version], [2])
m4_define([muffin_minor_version], [8])
m4_define([muffin_micro_version], [1])
m4_define([muffin_micro_version], [2])
m4_define([muffin_version],
[muffin_major_version.muffin_minor_version.muffin_micro_version])

27
src/core/boxes.c

@ -551,6 +551,26 @@ compare_rect_areas (gconstpointer a, gconstpointer b)
return b_area - a_area; /* positive ret value denotes b > a, ... */
}
/* ... and another helper for get_minimal_spanning_set_for_region()... */
static gboolean
check_strut_align (MetaStrut *strut, const MetaRectangle *rect)
{
/* Check whether @strut actually aligns to the side of @rect it claims */
switch (strut->side)
{
case META_SIDE_TOP:
return BOX_TOP (strut->rect) <= BOX_TOP (*rect);
case META_SIDE_BOTTOM:
return BOX_BOTTOM (strut->rect) >= BOX_BOTTOM (*rect);
case META_SIDE_LEFT:
return BOX_LEFT (strut->rect) <= BOX_LEFT (*rect);
case META_SIDE_RIGHT:
return BOX_RIGHT (strut->rect) >= BOX_RIGHT (*rect);
default:
return FALSE;
}
}
/**
* meta_rectangle_get_minimal_spanning_set_for_region:
* @basic_rect: Input rectangle
@ -635,7 +655,8 @@ meta_rectangle_get_minimal_spanning_set_for_region (
for (strut_iter = all_struts; strut_iter; strut_iter = strut_iter->next)
{
GList *rect_iter;
MetaRectangle *strut_rect = &((MetaStrut*)strut_iter->data)->rect;
MetaStrut *strut = (MetaStrut*)strut_iter->data;
MetaRectangle *strut_rect = &strut->rect;
tmp_list = ret;
ret = NULL;
@ -643,7 +664,9 @@ meta_rectangle_get_minimal_spanning_set_for_region (
while (rect_iter)
{
MetaRectangle *rect = (MetaRectangle*) rect_iter->data;
if (!meta_rectangle_overlap (rect, strut_rect))
if (!meta_rectangle_overlap (strut_rect, rect) ||
!check_strut_align (strut, basic_rect))
ret = g_list_prepend (ret, rect);
else
{

8
src/core/keybindings.c

@ -2324,11 +2324,11 @@ handle_move_to (MetaDisplay *display,
{
guint direction = binding->handler->data;
MetaRectangle work_area;
MetaRectangle outer;
int new_x, new_y;
MetaRectangle work_area, outer;
int monitor, new_x, new_y;
meta_window_get_work_area_all_monitors (window, &work_area);
monitor = meta_screen_get_current_monitor (window->screen);
meta_window_get_work_area_for_monitor (window, monitor, &work_area);
meta_window_get_outer_rect (window, &outer);
if (direction & META_MOVE_TO_XCHANGE_FLAG) {

44
src/core/screen.c

@ -2101,27 +2101,39 @@ meta_screen_get_monitor_for_rect (MetaScreen *screen,
MetaRectangle *rect)
{
int i;
int best_monitor, monitor_score;
int best_monitor, monitor_score, rect_area;
if (screen->n_monitor_infos == 1)
return &screen->monitor_infos[0];
best_monitor = 0;
monitor_score = 0;
monitor_score = -1;
rect_area = meta_rectangle_area (rect);
for (i = 0; i < screen->n_monitor_infos; i++)
{
MetaRectangle dest;
if (meta_rectangle_intersect (&screen->monitor_infos[i].rect,
rect,
&dest))
gboolean result;
int cur;
if (rect_area > 0)
{
int cur = meta_rectangle_area (&dest);
if (cur > monitor_score)
{
monitor_score = cur;
best_monitor = i;
}
MetaRectangle dest;
result = meta_rectangle_intersect (&screen->monitor_infos[i].rect,
rect,
&dest);
cur = meta_rectangle_area (&dest);
}
else
{
result = meta_rectangle_contains_rect (&screen->monitor_infos[i].rect,
rect);
cur = rect_area;
}
if (result && cur > monitor_score)
{
monitor_score = cur;
best_monitor = i;
}
}
@ -2139,6 +2151,14 @@ meta_screen_get_monitor_for_window (MetaScreen *screen,
return meta_screen_get_monitor_for_rect (screen, &window_rect);
}
int
meta_screen_get_monitor_index_for_rect (MetaScreen *screen,
MetaRectangle *rect)
{
const MetaMonitorInfo *monitor = meta_screen_get_monitor_for_rect (screen, rect);
return monitor->number;
}
LOCAL_SYMBOL const MetaMonitorInfo*
meta_screen_get_monitor_neighbor (MetaScreen *screen,
int which_monitor,

42
src/core/testboxes.c

@ -240,7 +240,7 @@ static GSList*
get_strut_list (int which)
{
GSList *ans;
MetaDirection wc = 0; /* wc == who cares? ;-) */
MetaSide wc = 0; /* wc == who cares? ;-) */
ans = NULL;
@ -250,32 +250,32 @@ get_strut_list (int which)
case 0:
break;
case 1:
ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 1600, 20, wc));
ans = g_slist_prepend (ans, new_meta_strut ( 400, 1160, 1600, 40, wc));
ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 1600, 20, META_SIDE_TOP));
ans = g_slist_prepend (ans, new_meta_strut ( 400, 1160, 1600, 40, META_SIDE_BOTTOM));
break;
case 2:
ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 1600, 20, wc));
ans = g_slist_prepend (ans, new_meta_strut ( 800, 1100, 400, 100, wc));
ans = g_slist_prepend (ans, new_meta_strut ( 300, 1150, 150, 50, wc));
ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 1600, 20, META_SIDE_TOP));
ans = g_slist_prepend (ans, new_meta_strut ( 800, 1100, 400, 100, META_SIDE_BOTTOM));
ans = g_slist_prepend (ans, new_meta_strut ( 300, 1150, 150, 50, META_SIDE_BOTTOM));
break;
case 3:
ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 1600, 20, wc));
ans = g_slist_prepend (ans, new_meta_strut ( 800, 1100, 400, 100, wc));
ans = g_slist_prepend (ans, new_meta_strut ( 300, 1150, 80, 50, wc));
ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 1600, 20, META_SIDE_TOP));
ans = g_slist_prepend (ans, new_meta_strut ( 800, 1100, 400, 100, META_SIDE_LEFT));
ans = g_slist_prepend (ans, new_meta_strut ( 300, 1150, 80, 50, META_SIDE_BOTTOM));
ans = g_slist_prepend (ans, new_meta_strut ( 700, 525, 200, 150, wc));
break;
case 4:
ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 800, 1200, wc));
ans = g_slist_prepend (ans, new_meta_strut ( 800, 0, 1600, 20, wc));
ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 800, 1200, META_SIDE_LEFT));
ans = g_slist_prepend (ans, new_meta_strut ( 800, 0, 1600, 20, META_SIDE_TOP));
break;
case 5:
ans = g_slist_prepend (ans, new_meta_strut ( 800, 0, 1600, 20, wc));
ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 800, 1200, wc));
ans = g_slist_prepend (ans, new_meta_strut ( 800, 10, 800, 1200, wc));
ans = g_slist_prepend (ans, new_meta_strut ( 800, 0, 1600, 20, META_SIDE_TOP));
ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 800, 1200, META_SIDE_LEFT));
ans = g_slist_prepend (ans, new_meta_strut ( 800, 10, 800, 1200, META_SIDE_RIGHT));
break;
case 6:
ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 1600, 40, wc));
ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 1600, 20, wc));
ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 1600, 40, META_SIDE_TOP));
ans = g_slist_prepend (ans, new_meta_strut ( 0, 0, 1600, 20, META_SIDE_TOP));
break;
}
@ -625,15 +625,9 @@ test_regions_okay ()
/*************************************************************/
region = get_screen_region (3);
tmp = NULL;
tmp = g_list_prepend (tmp, new_meta_rect ( 380, 675, 420, 525)); /* 220500 */
tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 300, 1180)); /* 354000 */
tmp = g_list_prepend (tmp, new_meta_rect ( 380, 20, 320, 1180)); /* 377600 */
tmp = g_list_prepend (tmp, new_meta_rect ( 0, 675, 800, 475)); /* 380000 */
tmp = g_list_prepend (tmp, new_meta_rect (1200, 20, 400, 1180)); /* 472000 */
tmp = g_list_prepend (tmp, new_meta_rect ( 0, 675, 1600, 425)); /* 680000 */
tmp = g_list_prepend (tmp, new_meta_rect ( 900, 20, 700, 1080)); /* 756000 */
tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 700, 1130)); /* 791000 */
tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 1600, 505)); /* 808000 */
tmp = g_list_prepend (tmp, new_meta_rect ( 380, 20, 1220, 1180)); /* 377600 */
tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 1600, 1130)); /* 791000 */
#if 0
printf ("Got to here...\n");
char region_list[(RECT_LENGTH+2) * g_list_length (region)];

39
src/core/workspace.c

@ -1037,6 +1037,45 @@ void
meta_workspace_set_builtin_struts (MetaWorkspace *workspace,
GSList *struts)
{
MetaScreen *screen = workspace->screen;
GSList *l;
for (l = struts; l; l = l->next)
{
MetaStrut *strut = l->data;
int idx = meta_screen_get_monitor_index_for_rect (screen, &strut->rect);
switch (strut->side)
{
case META_SIDE_TOP:
if (meta_screen_get_monitor_neighbor (screen, idx, META_SCREEN_UP))
continue;
strut->rect.height += strut->rect.y;
strut->rect.y = 0;
break;
case META_SIDE_BOTTOM:
if (meta_screen_get_monitor_neighbor (screen, idx, META_SCREEN_DOWN))
continue;
strut->rect.height = screen->rect.height - strut->rect.y;
break;
case META_SIDE_LEFT:
if (meta_screen_get_monitor_neighbor (screen, idx, META_SCREEN_LEFT))
continue;
strut->rect.width += strut->rect.x;
strut->rect.x = 0;
break;
case META_SIDE_RIGHT:
if (meta_screen_get_monitor_neighbor (screen, idx, META_SCREEN_RIGHT))
continue;
strut->rect.width = screen->rect.width - strut->rect.x;
break;
}
}
/* Reordering doesn't actually matter, so we don't catch all
* no-impact changes, but this is just a (possibly unnecessary
* anyways) optimization */

4
src/meta/screen.h

@ -89,6 +89,10 @@ int meta_screen_get_current_monitor (MetaScreen *screen);
void meta_screen_get_monitor_geometry (MetaScreen *screen,
int monitor,
MetaRectangle *geometry);
int meta_screen_get_monitor_index_for_rect (MetaScreen *screen,
MetaRectangle *rect);
MetaWindow* meta_screen_get_mouse_window (MetaScreen *screen,
MetaWindow *not_this_one);

Loading…
Cancel
Save