--- sourceforge.net/trunk/rdesktop/xwin.c 2003/02/18 13:51:43 332 +++ sourceforge.net/trunk/rdesktop/xwin.c 2003/05/15 14:26:15 373 @@ -59,6 +59,11 @@ static BOOL ownbackstore; static Pixmap backstore; +/* Moving in single app mode */ +static BOOL moving_wnd; +static int move_x_offset = 0; +static int move_y_offset = 0; + /* MWM decorations */ #define MWM_HINTS_DECORATIONS (1L << 1) #define PROP_MOTIF_WM_HINTS_ELEMENTS 5 @@ -397,8 +402,9 @@ uint32 pixel = 0; while (out < end) { - memcpy(&pixel, data, 3); - data += 3; + pixel = *(data++); + pixel |= *(data++) << 8; + pixel |= *(data++) << 16; *(out++) = pixel; } } @@ -858,7 +864,11 @@ /* If win_button_size is nonzero, enable single app mode */ if (xevent.xbutton.y < win_button_size) { - /* Check from right to left: */ + /* Stop moving window when button is released, regardless of cursor position */ + if (moving_wnd && (xevent.type == ButtonRelease)) + moving_wnd = False; + + /* Check from right to left: */ if (xevent.xbutton.x >= width - win_button_size) { @@ -880,12 +890,23 @@ DefaultScreen(display)); break; } + else if (xevent.xbutton.x <= win_button_size) + { + /* The system menu. Ignore. */ + break; + } else { - /* Ignore clicks to the rest of the border. This includes - the system menu, but also inhibits double clicks on the - border itself. */ + /* The title bar. */ + if ((xevent.type == ButtonPress) && !fullscreen + && hide_decorations) + { + moving_wnd = True; + move_x_offset = xevent.xbutton.x; + move_y_offset = xevent.xbutton.y; + } break; + } } @@ -894,6 +915,14 @@ break; case MotionNotify: + if (moving_wnd) + { + XMoveWindow(display, wnd, + xevent.xmotion.x_root - move_x_offset, + xevent.xmotion.y_root - move_y_offset); + break; + } + if (fullscreen && !focused) XSetInputFocus(display, wnd, RevertToPointerRoot, CurrentTime); @@ -1342,6 +1371,15 @@ RESET_FUNCTION(opcode); } +static uint8 hatch_patterns[] = { + 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, /* 0 - bsHorizontal */ + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, /* 1 - bsVertical */ + 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01, /* 2 - bsFDiagonal */ + 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, /* 3 - bsBDiagonal */ + 0x08, 0x08, 0x08, 0xff, 0x08, 0x08, 0x08, 0x08, /* 4 - bsCross */ + 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81 /* 5 - bsDiagCross */ +}; + void ui_patblt(uint8 opcode, /* dest */ int x, int y, int cx, int cy, @@ -1359,6 +1397,19 @@ FILL_RECTANGLE(x, y, cx, cy); break; + case 2: /* Hatch */ + fill = (Pixmap) ui_create_glyph(8, 8, hatch_patterns + brush->pattern[0] * 8); + SET_FOREGROUND(bgcolour); + SET_BACKGROUND(fgcolour); + XSetFillStyle(display, gc, FillOpaqueStippled); + XSetStipple(display, gc, fill); + XSetTSOrigin(display, gc, brush->xorigin, brush->yorigin); + FILL_RECTANGLE(x, y, cx, cy); + XSetFillStyle(display, gc, FillSolid); + XSetTSOrigin(display, gc, 0, 0); + ui_destroy_glyph((HGLYPH) fill); + break; + case 3: /* Pattern */ for (i = 0; i != 8; i++) ipattern[7 - i] = brush->pattern[i];