synch with bb-cvs.

add window resize zones. the resource has been renamed from windowZones to resizeZones.
This commit is contained in:
Dana Jansens 2002-07-09 06:09:10 +00:00
parent 8e34bfcfcb
commit 0c04fb5260
3 changed files with 48 additions and 15 deletions

View file

@ -412,6 +412,12 @@ void BScreen::saveWindowToWindowSnap(bool s) {
}
void BScreen::saveResizeZones(unsigned int z) {
resource.resize_zones = z;
config->setValue(screenstr + "resizeZones", resource.resize_zones);
}
void BScreen::saveWindowCornerSnap(bool s) {
resource.window_corner_snap = s;
config->setValue(screenstr + "windowCornerSnap",
@ -505,6 +511,7 @@ void BScreen::save_rc(void) {
saveAutoRaise(resource.auto_raise);
saveImageDither(doImageDither());
saveAAFonts(resource.aa_fonts);
saveResizeZones(resource.resize_zones);
saveOpaqueMove(resource.opaque_move);
saveFullMax(resource.full_max);
saveFocusNew(resource.focus_new);
@ -551,6 +558,11 @@ void BScreen::load_rc(void) {
if (! config->getValue(screenstr + "antialiasFonts", resource.aa_fonts))
resource.aa_fonts = true;
if (! config->getValue(screenstr + "resizeZones", resource.resize_zones) ||
(resource.resize_zones != 1 && resource.resize_zones != 2 &&
resource.resize_zones != 4))
resource.resize_zones = 4;
if (! config->getValue(screenstr + "hideToolbar", resource.hide_toolbar))
resource.hide_toolbar = false;

View file

@ -156,7 +156,8 @@ private:
int toolbar_placement, toolbar_width_percent, placement_policy,
edge_snap_threshold, row_direction, col_direction;
unsigned int handle_width, bevel_width, frame_width, border_width;
unsigned int handle_width, bevel_width, frame_width, border_width,
resize_zones;
#ifdef HAVE_STRFTIME
std::string strftime_format;
@ -241,6 +242,8 @@ public:
{ return resource.frame_width; }
inline unsigned int getBorderWidth(void) const
{ return resource.border_width; }
inline unsigned int getResizeZones(void) const
{ return resource.resize_zones; }
inline unsigned int getCurrentWorkspaceID(void)
{ return current_workspace->getID(); }
@ -276,6 +279,7 @@ public:
void saveHideToolbar(bool h);
void saveWindowToWindowSnap(bool s);
void saveWindowCornerSnap(bool s);
void saveResizeZones(unsigned int z);
inline void iconUpdate(void) { iconmenu->update(); }
#ifdef HAVE_STRFTIME

View file

@ -252,8 +252,7 @@ BlackboxWindow::BlackboxWindow(Blackbox *b, Window w, BScreen *s) {
client.normal_hint_flags & (PPosition|USPosition)) {
applyGravity(frame.rect);
if (blackbox->isStartup() ||
client.rect.intersects(screen->availableArea()))
if (blackbox->isStartup() || client.rect.intersects(screen->getRect()))
place_window = False;
}
@ -816,7 +815,9 @@ void BlackboxWindow::positionButtons(bool redecorate_label) {
void BlackboxWindow::reconfigure(void) {
restoreGravity(client.rect);
upsize();
applyGravity(frame.rect);
positionWindows();
decorate();
redrawWindowFrame();
@ -845,8 +846,7 @@ void BlackboxWindow::grabButtons(void) {
if (functions & Func_Resize)
blackbox->grabButton(Button3, Mod1Mask, frame.window, True,
ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
GrabModeAsync, frame.window,
blackbox->getLowerRightAngleCursor());
GrabModeAsync, frame.window, None);
// alt+middle lowers the window
blackbox->grabButton(Button2, Mod1Mask, frame.window, True,
ButtonReleaseMask, GrabModeAsync, GrabModeAsync,
@ -2759,7 +2759,7 @@ void BlackboxWindow::buttonPressEvent(const XButtonEvent *be) {
if (frame.title == be->window || frame.label == be->window) {
if (((be->time - lastButtonPressTime) <=
blackbox->getDoubleClickInterval()) ||
(be->state & ControlMask)) {
(be->state == ControlMask)) {
lastButtonPressTime = 0;
shade();
} else {
@ -3270,19 +3270,36 @@ void BlackboxWindow::motionNotifyEvent(const XMotionEvent *me) {
} else if (flags.resizing) {
doResize(me->x_root, me->y_root);
} else {
if (! flags.resizing && (me->state & Button1Mask) &&
(functions & Func_Move) &&
if (!flags.resizing && me->state & Button1Mask && (functions & Func_Move) &&
(frame.title == me->window || frame.label == me->window ||
frame.handle == me->window || frame.window == me->window)) {
beginMove(me->x_root, me->y_root);
} else if ((functions & Func_Resize) &&
(((me->state & Button1Mask) &&
(me->window == frame.right_grip ||
me->window == frame.left_grip)) ||
(me->state & (Mod1Mask | Button3Mask) &&
me->window == frame.window))) {
beginResize(me->x_root, me->y_root,
(me->window == frame.left_grip) ? BottomLeft : BottomRight);
(me->state & Button1Mask && (me->window == frame.right_grip ||
me->window == frame.left_grip)) ||
(me->state & Button3Mask && me->state & Mod1Mask &&
me->window == frame.window)) {
unsigned int zones = screen->getResizeZones();
Corner corner;
if (me->window == frame.left_grip) {
corner = BottomLeft;
} else if (me->window == frame.right_grip || zones == 1) {
corner = BottomRight;
} else {
bool top;
bool left = (me->x_root - frame.rect.x() <=
static_cast<signed>(frame.rect.width() / 2));
if (zones == 2)
top = False;
else // (zones == 4)
top = (me->y_root - frame.rect.y() <=
static_cast<signed>(frame.rect.height() / 2));
corner = (top ? (left ? TopLeft : TopRight) :
(left ? BottomLeft : BottomRight));
}
beginResize(me->x_root, me->y_root, corner);
}
}
}