short-circuit the "only one xinerama" case, and use outer rect of window
2002-06-08 Havoc Pennington <hp@pobox.com> * src/screen.c (meta_screen_get_xinerama_for_window): short-circuit the "only one xinerama" case, and use outer rect of window instead of window->rect, so we get root window coords. * src/theme.c (meta_frame_layout_get_borders): if fullscreen all frame edges are zero-width. * src/frame.c (meta_frame_get_flags): init fullscreen flag. * src/common.h (enum): add META_FRAME_FULLSCREEN frame flag * src/place.c: fix up calls to meta_window_get_work_area * src/window.c (meta_window_get_work_area): add an arg for whether the work area is for the screen or the xinerama subscreen. (constrain_position): fix up calls to meta_window_get_work_area (constrain_size): ditto * src/screen.c (meta_screen_new): add METACITY_DEBUG_XINERAMA environment variable which simulates xinerama on a single head.
This commit is contained in:
parent
9e8800561e
commit
2b780e5486
23
ChangeLog
23
ChangeLog
@ -1,3 +1,26 @@
|
||||
2002-06-08 Havoc Pennington <hp@pobox.com>
|
||||
|
||||
* src/screen.c (meta_screen_get_xinerama_for_window):
|
||||
short-circuit the "only one xinerama" case, and use outer rect of
|
||||
window instead of window->rect, so we get root window coords.
|
||||
|
||||
* src/theme.c (meta_frame_layout_get_borders): if fullscreen all
|
||||
frame edges are zero-width.
|
||||
|
||||
* src/frame.c (meta_frame_get_flags): init fullscreen flag.
|
||||
|
||||
* src/common.h (enum): add META_FRAME_FULLSCREEN frame flag
|
||||
|
||||
* src/place.c: fix up calls to meta_window_get_work_area
|
||||
|
||||
* src/window.c (meta_window_get_work_area): add an arg for whether
|
||||
the work area is for the screen or the xinerama subscreen.
|
||||
(constrain_position): fix up calls to meta_window_get_work_area
|
||||
(constrain_size): ditto
|
||||
|
||||
* src/screen.c (meta_screen_new): add METACITY_DEBUG_XINERAMA
|
||||
environment variable which simulates xinerama on a single head.
|
||||
|
||||
2002-06-08 Havoc Pennington <hp@pobox.com>
|
||||
|
||||
* src/window.c (update_struts): only invalidate things if the
|
||||
|
@ -41,7 +41,8 @@ typedef enum
|
||||
META_FRAME_STUCK = 1 << 8,
|
||||
META_FRAME_MAXIMIZED = 1 << 9,
|
||||
META_FRAME_ALLOWS_SHADE = 1 << 10,
|
||||
META_FRAME_ALLOWS_MOVE = 1 << 11
|
||||
META_FRAME_ALLOWS_MOVE = 1 << 11,
|
||||
META_FRAME_FULLSCREEN = 1 << 12
|
||||
} MetaFrameFlags;
|
||||
|
||||
typedef enum
|
||||
|
@ -246,6 +246,9 @@ meta_frame_get_flags (MetaFrame *frame)
|
||||
if (frame->window->maximized)
|
||||
flags |= META_FRAME_MAXIMIZED;
|
||||
|
||||
if (frame->window->fullscreen)
|
||||
flags |= META_FRAME_FULLSCREEN;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ find_next_cascade (MetaWindow *window,
|
||||
* cascade_x, cascade_y are the target position
|
||||
* of NW corner of window frame.
|
||||
*/
|
||||
meta_window_get_work_area (window, &work_area);
|
||||
meta_window_get_work_area (window, TRUE, &work_area);
|
||||
|
||||
cascade_x = MAX (0, work_area.x);
|
||||
cascade_y = MAX (0, work_area.y);
|
||||
@ -215,7 +215,7 @@ constrain_placement (MetaWindow *window,
|
||||
MetaRectangle work_area;
|
||||
int nw_x, nw_y;
|
||||
|
||||
meta_window_get_work_area (window, &work_area);
|
||||
meta_window_get_work_area (window, TRUE, &work_area);
|
||||
|
||||
nw_x = work_area.x;
|
||||
nw_y = work_area.y;
|
||||
@ -561,7 +561,7 @@ get_vertical_edges (MetaWindow *window,
|
||||
edges = g_new (int, n_edges);
|
||||
|
||||
/* workspace/screen edges */
|
||||
meta_window_get_work_area (window, &work_area);
|
||||
meta_window_get_work_area (window, FALSE, &work_area);
|
||||
|
||||
edges[i] = work_area.x;
|
||||
++i;
|
||||
@ -634,7 +634,7 @@ get_horizontal_edges (MetaWindow *window,
|
||||
edges = g_new (int, n_edges);
|
||||
|
||||
/* workspace/screen edges */
|
||||
meta_window_get_work_area (window, &work_area);
|
||||
meta_window_get_work_area (window, FALSE, &work_area);
|
||||
|
||||
edges[i] = work_area.y;
|
||||
++i;
|
||||
|
31
src/screen.c
31
src/screen.c
@ -293,6 +293,28 @@ meta_screen_new (MetaDisplay *display,
|
||||
* we can use the field unconditionally
|
||||
*/
|
||||
if (screen->n_xinerama_infos == 0)
|
||||
{
|
||||
if (g_getenv ("METACITY_DEBUG_XINERAMA"))
|
||||
{
|
||||
meta_topic (META_DEBUG_XINERAMA,
|
||||
"Pretending a single monitor has two Xinerama screens\n");
|
||||
|
||||
screen->xinerama_infos = g_new (MetaXineramaScreenInfo, 2);
|
||||
screen->n_xinerama_infos = 2;
|
||||
|
||||
screen->xinerama_infos[0].number = 0;
|
||||
screen->xinerama_infos[0].x_origin = 0;
|
||||
screen->xinerama_infos[0].y_origin = 0;
|
||||
screen->xinerama_infos[0].width = screen->width / 2;
|
||||
screen->xinerama_infos[0].height = screen->height;
|
||||
|
||||
screen->xinerama_infos[1].number = 1;
|
||||
screen->xinerama_infos[1].x_origin = screen->width / 2;
|
||||
screen->xinerama_infos[1].y_origin = 0;
|
||||
screen->xinerama_infos[1].width = screen->width / 2 + screen->width % 2;
|
||||
screen->xinerama_infos[1].height = screen->height;
|
||||
}
|
||||
else
|
||||
{
|
||||
meta_topic (META_DEBUG_XINERAMA,
|
||||
"No Xinerama screens, using default screen info\n");
|
||||
@ -306,6 +328,7 @@ meta_screen_new (MetaDisplay *display,
|
||||
screen->xinerama_infos[0].width = screen->width;
|
||||
screen->xinerama_infos[0].height = screen->height;
|
||||
}
|
||||
}
|
||||
|
||||
g_assert (screen->n_xinerama_infos > 0);
|
||||
g_assert (screen->xinerama_infos != NULL);
|
||||
@ -812,6 +835,12 @@ meta_screen_get_xinerama_for_window (MetaScreen *screen,
|
||||
{
|
||||
int i;
|
||||
int best_xinerama, xinerama_score;
|
||||
MetaRectangle window_rect;
|
||||
|
||||
if (screen->n_xinerama_infos == 1)
|
||||
return &screen->xinerama_infos[0];
|
||||
|
||||
meta_window_get_outer_rect (window, &window_rect);
|
||||
|
||||
best_xinerama = 0;
|
||||
xinerama_score = 0;
|
||||
@ -826,7 +855,7 @@ meta_screen_get_xinerama_for_window (MetaScreen *screen,
|
||||
screen_info.width = screen->xinerama_infos[i].width;
|
||||
screen_info.height = screen->xinerama_infos[i].height;
|
||||
|
||||
if (meta_rectangle_intersect (&screen_info, &window->rect, &dest))
|
||||
if (meta_rectangle_intersect (&screen_info, &window_rect, &dest))
|
||||
{
|
||||
if (dest.width * dest.height > xinerama_score)
|
||||
{
|
||||
|
12
src/theme.c
12
src/theme.c
@ -376,6 +376,18 @@ meta_frame_layout_get_borders (const MetaFrameLayout *layout,
|
||||
else
|
||||
*bottom_height = layout->bottom_height;
|
||||
}
|
||||
|
||||
if (flags & META_FRAME_FULLSCREEN)
|
||||
{
|
||||
if (top_height)
|
||||
*top_height = 0;
|
||||
if (bottom_height)
|
||||
*bottom_height = 0;
|
||||
if (left_width)
|
||||
*left_width = 0;
|
||||
if (right_width)
|
||||
*right_width = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
27
src/window.c
27
src/window.c
@ -4983,7 +4983,7 @@ constrain_size (MetaWindow *window,
|
||||
|
||||
#define FLOOR(value, base) ( ((int) ((value) / (base))) * (base) )
|
||||
|
||||
meta_window_get_work_area (window, &work_area);
|
||||
meta_window_get_work_area (window, TRUE, &work_area);
|
||||
|
||||
/* Get the allowed size ranges, considering maximized, etc. */
|
||||
if (window->fullscreen)
|
||||
@ -5113,10 +5113,6 @@ constrain_position (MetaWindow *window,
|
||||
int *new_x,
|
||||
int *new_y)
|
||||
{
|
||||
MetaRectangle work_area;
|
||||
|
||||
meta_window_get_work_area (window, &work_area);
|
||||
|
||||
/* frame member variables should NEVER be used in here, only
|
||||
* MetaFrameGeometry
|
||||
*/
|
||||
@ -5160,6 +5156,10 @@ constrain_position (MetaWindow *window,
|
||||
}
|
||||
else if (window->maximized)
|
||||
{
|
||||
MetaRectangle work_area;
|
||||
|
||||
meta_window_get_work_area (window, TRUE, &work_area);
|
||||
|
||||
x = work_area.x;
|
||||
y = work_area.y;
|
||||
if (window->frame)
|
||||
@ -5183,6 +5183,9 @@ constrain_position (MetaWindow *window,
|
||||
int nw_x, nw_y;
|
||||
int se_x, se_y;
|
||||
int offscreen_w, offscreen_h;
|
||||
MetaRectangle work_area;
|
||||
|
||||
meta_window_get_work_area (window, FALSE, &work_area);
|
||||
|
||||
/* (FIXME instead of TITLEBAR_LENGTH_ONSCREEN, get the actual
|
||||
* size of the menu control?).
|
||||
@ -5676,17 +5679,21 @@ meta_window_set_gravity (MetaWindow *window,
|
||||
|
||||
void
|
||||
meta_window_get_work_area (MetaWindow *window,
|
||||
gboolean for_current_xinerama,
|
||||
MetaRectangle *area)
|
||||
{
|
||||
MetaRectangle space_area;
|
||||
GList *tmp;
|
||||
const MetaXineramaScreenInfo *xinerama;
|
||||
|
||||
int left_strut;
|
||||
int right_strut;
|
||||
int top_strut;
|
||||
int bottom_strut;
|
||||
|
||||
if (for_current_xinerama)
|
||||
{
|
||||
const MetaXineramaScreenInfo *xinerama;
|
||||
|
||||
xinerama = meta_screen_get_xinerama_for_window (window->screen,
|
||||
window);
|
||||
|
||||
@ -5694,6 +5701,14 @@ meta_window_get_work_area (MetaWindow *window,
|
||||
right_strut = window->screen->width - xinerama->width - xinerama->x_origin;
|
||||
top_strut = xinerama->y_origin;
|
||||
bottom_strut = window->screen->height - xinerama->height - xinerama->y_origin;
|
||||
}
|
||||
else
|
||||
{
|
||||
left_strut = 0;
|
||||
right_strut = 0;
|
||||
top_strut = 0;
|
||||
bottom_strut = 0;
|
||||
}
|
||||
|
||||
tmp = meta_window_get_workspaces (window);
|
||||
|
||||
|
@ -372,6 +372,7 @@ gboolean meta_window_visible_on_workspace (MetaWindow *window,
|
||||
|
||||
/* Get minimum work area for all workspaces we're on */
|
||||
void meta_window_get_work_area (MetaWindow *window,
|
||||
gboolean for_current_xinerama,
|
||||
MetaRectangle *area);
|
||||
|
||||
gboolean meta_window_same_application (MetaWindow *window,
|
||||
|
Loading…
Reference in New Issue
Block a user