+ // TODO: Do something with other buttons
+ // - Window menu for example
+ if( msg->Button != 0 )
+ return 1; // pass on
+
+ if( !msg->bPressed )
+ btn1_down = 0;
+
+ #define HOTSPOTR(x,y,w,h) Decorator_INT_CoordInRangeR(msg->X, msg->Y, x, y, w, h)
+ #define HOTSPOTA(sx,sy,ex,ey) Decorator_INT_CoordInRange(msg->X, msg->Y, sx, sy, ew, eh)
+ // Left resize border
+ if( msg->bPressed && HOTSPOTR(-ciSideBorderWidth, -ciTitlebarHeight,
+ ciSideBorderWidth, ciTitlebarHeight+Window->H+ciBottomBorderWidth) )
+ {
+ btn1_down = Window;
+ btn1_mode = BTN1_RLEFT;
+ return 0;
+ }
+ // Right resize border
+ if( msg->bPressed && HOTSPOTR(Window->W, -ciTitlebarHeight,
+ ciSideBorderWidth, ciTitlebarHeight+Window->H+ciBottomBorderWidth) )
+ {
+ btn1_down = Window;
+ btn1_mode = BTN1_RRIGHT;
+ return 0;
+ }
+ // Bottom resize border
+ if( msg->bPressed && HOTSPOTR(0, Window->H,
+ Window->W, ciTitlebarHeight) )
+ {
+ btn1_down = Window;
+ btn1_mode = BTN1_RBOTTOM;
+ return 0;
+ }
+ // Titlebar buttons
+ if( msg->bPressed && Decorator_INT_CoordInRangeR(msg->X, msg->Y, BTN_CLOSE(Window)) )
+ {
+ WM_SendMessage(NULL, Window, WNDMSG_CLOSE, 0, NULL);
+ return 0;
+ }
+ // Titlebar - Move
+ if( msg->bPressed && msg->Y < 0 )
+ {
+ btn1_down = Window;
+ btn1_mode = BTN1_MOVE;
+ return 0;
+ }
+ #undef HOTSPOTR
+ #undef HOTSPOTA
+
+ return 1; }