Merge pull request #1067 from BlueUsername/tiling-to-floating-window-fix

Fix a bug moving between a tiled and a floating screen.
This commit is contained in:
Emmanuel Lepage Vallée 2016-09-07 16:20:20 -04:00 committed by GitHub
commit 587cc530c7
3 changed files with 16 additions and 1 deletions

View File

@ -1506,7 +1506,7 @@ client_resize_do(client_t *c, area_t geometry, bool force_notice)
bool java_is_broken = true; bool java_is_broken = true;
screen_t *new_screen = c->screen; screen_t *new_screen = c->screen;
if(!screen_coord_in_screen(new_screen, geometry.x, geometry.y)) if(!screen_area_in_screen(new_screen, geometry))
new_screen = screen_getbycoord(geometry.x, geometry.y); new_screen = screen_getbycoord(geometry.x, geometry.y);
if(c->geometry.width == geometry.width if(c->geometry.width == geometry.width

View File

@ -731,6 +731,20 @@ screen_coord_in_screen(screen_t *s, int x, int y)
&& (y >= s->geometry.y && y < s->geometry.y + s->geometry.height); && (y >= s->geometry.y && y < s->geometry.y + s->geometry.height);
} }
/** Is there any overlap between the given geometry and a given screen?
* \param screen The logical screen number.
* \param geom The geometry
* \return True if there is any overlap between the geometry and a given screen.
*/
bool
screen_area_in_screen(screen_t *s, area_t geom)
{
return (geom.x < s->geometry.x + s->geometry.width)
&& (geom.x + geom.width > s->geometry.x )
&& (geom.y < s->geometry.y + s->geometry.height)
&& (geom.y + geom.height > s->geometry.y);
}
void screen_update_workarea(screen_t *screen) void screen_update_workarea(screen_t *screen)
{ {
area_t area = screen->geometry; area_t area = screen->geometry;

View File

@ -50,6 +50,7 @@ void screen_class_setup(lua_State *L);
void screen_scan(void); void screen_scan(void);
screen_t *screen_getbycoord(int, int); screen_t *screen_getbycoord(int, int);
bool screen_coord_in_screen(screen_t *, int, int); bool screen_coord_in_screen(screen_t *, int, int);
bool screen_area_in_screen(screen_t *, area_t);
int screen_get_index(screen_t *); int screen_get_index(screen_t *);
area_t display_area_get(void); area_t display_area_get(void);
void screen_client_moveto(client_t *, screen_t *, bool); void screen_client_moveto(client_t *, screen_t *, bool);