Put titlebar resize for floating in titlebar_update_geometry_floating() function and call it for movemouse

This fix the problem when moving a window on a floating layout on screen N to
non-floating layout on screen M
This commit is contained in:
Julien Danjou 2008-03-15 15:24:47 +01:00
parent c9450c6fbd
commit 31f6010eda
4 changed files with 35 additions and 21 deletions

View File

@ -546,27 +546,7 @@ client_resize(Client *c, area_t geometry)
{
if(!c->ismax)
c->f_geometry = geometry;
switch(c->titlebar.position)
{
case Top:
simplewindow_move_resize(c->titlebar.sw,
geometry.x,
geometry.y - c->titlebar.sw->geometry.height,
geometry.width,
c->titlebar.sw->geometry.height);
break;
case Bottom:
simplewindow_move_resize(c->titlebar.sw,
geometry.x,
geometry.y + geometry.height + 2 * c->border,
geometry.width,
c->titlebar.sw->geometry.height);
break;
default:
break;
}
titlebar_update(c);
titlebar_update_geometry_floating(c);
}
XConfigureWindow(globalconf.display, c->win,

View File

@ -28,6 +28,7 @@
#include "event.h"
#include "window.h"
#include "client.h"
#include "titlebar.h"
#include "layouts/floating.h"
#include "layouts/tile.h"
#include "common/xscreen.h"
@ -97,6 +98,7 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
{
geometry.x = ocx + (ev.xmotion.x - x);
geometry.y = ocy + (ev.xmotion.y - y);
if(abs(geometry.x) < globalconf.screens[screen].snap + area.x && geometry.x > area.x)
geometry.x = area.x;
else if(abs((area.x + area.width) - (geometry.x + c->geometry.width + 2 * c->border))
@ -107,9 +109,14 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
else if(abs((area.y + area.height) - (geometry.y + c->geometry.height + 2 * c->border))
< globalconf.screens[screen].snap)
geometry.y = area.y + area.height - c->geometry.height - 2 * c->border;
geometry.width = c->geometry.width;
geometry.height = c->geometry.height;
client_resize(c, geometry);
titlebar_update_geometry_floating(c);
while(XCheckMaskEvent(globalconf.display, PointerMotionMask, &ev));
}
else

View File

@ -56,6 +56,32 @@ titlebar_update(Client *c)
draw_context_delete(ctx);
}
void
titlebar_update_geometry_floating(Client *c)
{
switch(c->titlebar.position)
{
default:
return;
case Top:
simplewindow_move_resize(c->titlebar.sw,
c->geometry.x,
c->geometry.y - c->titlebar.sw->geometry.height,
c->geometry.width,
c->titlebar.sw->geometry.height);
break;
case Bottom:
simplewindow_move_resize(c->titlebar.sw,
c->geometry.x,
c->geometry.y + c->geometry.height + 2 * c->border,
c->geometry.width,
c->titlebar.sw->geometry.height);
break;
}
titlebar_update(c);
}
area_t
titlebar_update_geometry(Client *c, area_t geometry)
{

View File

@ -25,6 +25,7 @@
#include "structs.h"
void titlebar_update(Client *);
void titlebar_update_geometry_floating(Client *);
area_t titlebar_update_geometry(Client *, area_t);
Uicb uicb_client_toggletitlebar;