|
@@ -187,25 +187,25 @@ static void DispatchMouseWheelEvent(Wind
|
|
|
|
|
|
wi1 = &w->widget[widget];
|
|
|
wi2 = &w->widget[widget + 1];
|
|
|
|
|
|
/* The listbox can only scroll if scrolling was done on the scrollbar itself,
|
|
|
* or on the listbox (and the next item is (must be) the scrollbar)
|
|
|
* XXX - should be rewritten as a widget-dependent scroller but that's
|
|
|
* not happening until someone rewrites the whole widget-code */
|
|
|
if ((sb = &w->vscroll, wi1->type == WWT_SCROLLBAR) || (sb = &w->vscroll2, wi1->type == WWT_SCROLL2BAR) ||
|
|
|
(sb = &w->vscroll2, wi2->type == WWT_SCROLL2BAR) || (sb = &w->vscroll, wi2->type == WWT_SCROLLBAR) ) {
|
|
|
|
|
|
if (sb->count > sb->cap) {
|
|
|
int pos = clamp(sb->pos + wheel, 0, sb->count - sb->cap);
|
|
|
int pos = Clamp(sb->pos + wheel, 0, sb->count - sb->cap);
|
|
|
if (pos != sb->pos) {
|
|
|
sb->pos = pos;
|
|
|
SetWindowDirty(w);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
static void DrawOverlappedWindow(Window* const *wz, int left, int top, int right, int bottom);
|
|
|
|
|
|
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom)
|
|
|
{
|
|
@@ -1286,26 +1286,26 @@ static bool HandleWindowDragging()
|
|
|
/* Your bottom border <-> other bottom border */
|
|
|
delta = abs(v->top + v->height - y - w->height);
|
|
|
if (delta <= vsnap) {
|
|
|
ny = v->top + v->height - w->height;
|
|
|
vsnap = delta;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/* Make sure the window doesn't leave the screen
|
|
|
* 13 is the height of the title bar */
|
|
|
nx = clamp(nx, 13 - t->right, _screen.width - 13 - t->left);
|
|
|
ny = clamp(ny, 0, _screen.height - 13);
|
|
|
nx = Clamp(nx, 13 - t->right, _screen.width - 13 - t->left);
|
|
|
ny = Clamp(ny, 0, _screen.height - 13);
|
|
|
|
|
|
/* Make sure the title bar isn't hidden by behind the main tool bar */
|
|
|
v = FindWindowById(WC_MAIN_TOOLBAR, 0);
|
|
|
if (v != NULL) {
|
|
|
int v_bottom = v->top + v->height;
|
|
|
int v_right = v->left + v->width;
|
|
|
if (ny + t->top >= v->top && ny + t->top < v_bottom) {
|
|
|
if ((v->left < 13 && nx + t->left < v->left) ||
|
|
|
(v_right > _screen.width - 13 && nx + t->right > v_right)) {
|
|
|
ny = v_bottom;
|
|
|
} else {
|
|
|
if (nx + t->left > v->left - 13 &&
|
|
@@ -2104,31 +2104,31 @@ void RelocateAllWindows(int neww, int ne
|
|
|
case WC_GAME_OPTIONS:
|
|
|
case WC_NETWORK_WINDOW:
|
|
|
top = (newh - w->height) >> 1;
|
|
|
left = (neww - w->width) >> 1;
|
|
|
break;
|
|
|
|
|
|
case WC_NEWS_WINDOW:
|
|
|
top = newh - w->height;
|
|
|
left = (neww - w->width) >> 1;
|
|
|
break;
|
|
|
|
|
|
case WC_STATUS_BAR:
|
|
|
ResizeWindow(w, clamp(neww, 320, 640) - w->width, 0);
|
|
|
ResizeWindow(w, Clamp(neww, 320, 640) - w->width, 0);
|
|
|
top = newh - w->height;
|
|
|
left = (neww - w->width) >> 1;
|
|
|
break;
|
|
|
|
|
|
case WC_SEND_NETWORK_MSG:
|
|
|
ResizeWindow(w, clamp(neww, 320, 640) - w->width, 0);
|
|
|
ResizeWindow(w, Clamp(neww, 320, 640) - w->width, 0);
|
|
|
top = (newh - 26); // 26 = height of status bar + height of chat bar
|
|
|
left = (neww - w->width) >> 1;
|
|
|
break;
|
|
|
|
|
|
case WC_CONSOLE:
|
|
|
IConsoleResize(w);
|
|
|
continue;
|
|
|
|
|
|
default:
|
|
|
left = w->left;
|
|
|
if (left + (w->width >> 1) >= neww) left = neww - w->width;
|
|
|
top = w->top;
|