mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-13 11:42:21 +00:00
dtappbuilder: ensure the resize box always inside the main window to avoid the
rendering glitch.
This commit is contained in:
parent
191f1476bd
commit
caf8c25c15
1 changed files with 57 additions and 8 deletions
|
@ -73,6 +73,16 @@ static void make_rect(
|
|||
RESIZE_DIR dir
|
||||
);
|
||||
|
||||
static void
|
||||
make_rect_in_rect(
|
||||
XRectangle *pr,
|
||||
XRectangle *new_r,
|
||||
XRectangle *r,
|
||||
int x,
|
||||
int y,
|
||||
RESIZE_DIR dir
|
||||
);
|
||||
|
||||
static void undo_resize(
|
||||
ABUndoRec undo_rec
|
||||
);
|
||||
|
@ -356,9 +366,9 @@ abobjP_resize_object_outline(
|
|||
static Widget parent;
|
||||
static Window rootwin;
|
||||
static Display *dpy;
|
||||
static XRectangle orig_r, r;
|
||||
static XRectangle orig_r, r, p_rect;
|
||||
static int last_x, last_y;
|
||||
int x,y;
|
||||
int x, y, x_tmp, y_tmp;
|
||||
char buf[80];
|
||||
|
||||
if (event->type == MotionNotify)
|
||||
|
@ -400,6 +410,16 @@ abobjP_resize_object_outline(
|
|||
rootwin = RootWindowOfScreen(XtScreen(xy_widget));
|
||||
|
||||
x_get_widget_rect(xy_widget, &orig_r);
|
||||
|
||||
x_get_widget_rect(parent, &p_rect);
|
||||
|
||||
XTranslateCoordinates(dpy, XtWindow(parent),
|
||||
rootwin, p_rect.x, p_rect.y, &x_tmp, &y_tmp,
|
||||
&win);
|
||||
|
||||
p_rect.x = x_tmp;
|
||||
p_rect.y = y_tmp;
|
||||
|
||||
if (obj_has_border_frame(obj)) /* We have a border-frame to deal with */
|
||||
{
|
||||
XRectangle pane_r;
|
||||
|
@ -413,8 +433,8 @@ abobjP_resize_object_outline(
|
|||
else
|
||||
border_w = 0;
|
||||
|
||||
orig_r.width--;
|
||||
orig_r.height--;
|
||||
if (orig_r.width > 0) orig_r.width--;
|
||||
if (orig_r.height > 0) orig_r.height--;
|
||||
|
||||
r = orig_r;
|
||||
|
||||
|
@ -432,7 +452,7 @@ abobjP_resize_object_outline(
|
|||
}
|
||||
else /* erase previous outline */
|
||||
{
|
||||
make_rect(&resize_rect, &r, last_x, last_y, dir);
|
||||
make_rect_in_rect(&p_rect, &resize_rect, &r, last_x, last_y, dir);
|
||||
x_fullscreen_box(xy_widget, rootwin,
|
||||
resize_rect.x, resize_rect.y,
|
||||
rect_right(&resize_rect),
|
||||
|
@ -440,7 +460,7 @@ abobjP_resize_object_outline(
|
|||
|
||||
}
|
||||
|
||||
make_rect(&resize_rect, &r, x, y, dir);
|
||||
make_rect_in_rect(&p_rect, &resize_rect, &r, x, y, dir);
|
||||
x_fullscreen_box(xy_widget, rootwin,
|
||||
resize_rect.x, resize_rect.y,
|
||||
rect_right(&resize_rect),
|
||||
|
@ -509,8 +529,8 @@ abobj_resize(
|
|||
XTranslateCoordinates(dpy, rootwin, XtWindow(parent),
|
||||
orig_x , orig_y, &trans_x, &trans_y, &win);
|
||||
|
||||
resize_rect.width++;
|
||||
resize_rect.height++;
|
||||
resize_rect.width++; if (!resize_rect.width) --resize_rect.width;
|
||||
resize_rect.height++; if (!resize_rect.height) --resize_rect.height;
|
||||
|
||||
/* Ensure new geometry fits within parent
|
||||
*/
|
||||
|
@ -844,6 +864,35 @@ make_rect (
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* calculate resize rect based on resize-direction & obj dimensions & a
|
||||
* boundary.
|
||||
*/
|
||||
static void
|
||||
make_rect_in_rect(
|
||||
XRectangle *pr,
|
||||
XRectangle *new_r,
|
||||
XRectangle *r,
|
||||
int x,
|
||||
int y,
|
||||
RESIZE_DIR dir
|
||||
)
|
||||
{
|
||||
int x_tmp, y_tmp;
|
||||
int pr_right = rect_right(pr);
|
||||
int pr_bottom = rect_bottom(pr);
|
||||
|
||||
if (x < pr->x) x_tmp = pr->x;
|
||||
else if (x > pr_right) x_tmp = pr_right;
|
||||
else x_tmp = x;
|
||||
|
||||
if (y < pr->y) y_tmp = pr->y;
|
||||
else if (y > pr_bottom) y_tmp = pr_bottom;
|
||||
else y_tmp = y;
|
||||
|
||||
make_rect(new_r, r, x_tmp, y_tmp, dir);
|
||||
}
|
||||
|
||||
/*
|
||||
* Function for undoing RESIZE
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue