From 76b3e2730e7d2a3a7e0f361c1559f6fbbe1d8288 Mon Sep 17 00:00:00 2001 From: jsorg71 Date: Mon, 31 Dec 2007 07:18:24 +0000 Subject: [PATCH] set dragging to false when module loads or popups close --- xrdp/xrdp_mm.c | 1 + xrdp/xrdp_wm.c | 81 ++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 70 insertions(+), 12 deletions(-) diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c index 5bf9202c..e7fa00f3 100644 --- a/xrdp/xrdp_mm.c +++ b/xrdp/xrdp_mm.c @@ -469,6 +469,7 @@ xrdp_mm_process_login_response(struct xrdp_mm* self, struct stream* s) { self->wm->login_mode = 10; self->wm->pro_layer->app_sck = self->mod->sck; + self->wm->dragging = 0; } } } diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c index 19820074..e3bffc72 100644 --- a/xrdp/xrdp_wm.c +++ b/xrdp/xrdp_wm.c @@ -664,13 +664,75 @@ xrdp_wm_move_window(struct xrdp_wm* self, struct xrdp_bitmap* wnd, return 0; } +/*****************************************************************************/ +static int APP_CC +xrdp_wm_undraw_dragging_box(struct xrdp_wm* self, int do_begin_end) +{ + int boxx; + int boxy; + + if (self == 0) + { + return 0; + } + if (self->dragging) + { + if (self->draggingxorstate) + { + if (do_begin_end) + { + xrdp_painter_begin_update(self->painter); + } + boxx = self->draggingx - self->draggingdx; + boxy = self->draggingy - self->draggingdy; + xrdp_wm_xor_pat(self, boxx, boxy, self->draggingcx, self->draggingcy); + self->draggingxorstate = 0; + if (do_begin_end) + { + xrdp_painter_end_update(self->painter); + } + } + } + return 0; +} + +/*****************************************************************************/ +static int APP_CC +xrdp_wm_draw_dragging_box(struct xrdp_wm* self, int do_begin_end) +{ + int boxx; + int boxy; + + if (self == 0) + { + return 0; + } + if (self->dragging) + { + if (!self->draggingxorstate) + { + if (do_begin_end) + { + xrdp_painter_begin_update(self->painter); + } + boxx = self->draggingx - self->draggingdx; + boxy = self->draggingy - self->draggingdy; + xrdp_wm_xor_pat(self, boxx, boxy, self->draggingcx, self->draggingcy); + self->draggingxorstate = 1; + if (do_begin_end) + { + xrdp_painter_end_update(self->painter); + } + } + } + return 0; +} + /*****************************************************************************/ int APP_CC xrdp_wm_mouse_move(struct xrdp_wm* self, int x, int y) { struct xrdp_bitmap* b; - int boxx; - int boxy; if (self == 0) { @@ -697,18 +759,10 @@ xrdp_wm_mouse_move(struct xrdp_wm* self, int x, int y) if (self->dragging) { xrdp_painter_begin_update(self->painter); - boxx = self->draggingx - self->draggingdx; - boxy = self->draggingy - self->draggingdy; - if (self->draggingxorstate) - { - xrdp_wm_xor_pat(self, boxx, boxy, self->draggingcx, self->draggingcy); - } + xrdp_wm_undraw_dragging_box(self, 0); self->draggingx = x; self->draggingy = y; - boxx = self->draggingx - self->draggingdx; - boxy = self->draggingy - self->draggingdy; - xrdp_wm_xor_pat(self, boxx, boxy, self->draggingcx, self->draggingcy); - self->draggingxorstate = 1; + xrdp_wm_draw_dragging_box(self, 0); xrdp_painter_end_update(self->painter); return 0; } @@ -1324,17 +1378,20 @@ xrdp_wm_idle(struct xrdp_wm* self) self->login_mode = 1; /* put the wm in login mode */ list_clear(self->log); xrdp_wm_delete_all_childs(self); + self->dragging = 0; xrdp_wm_init(self); } else if (self->login_mode == 2) { self->login_mode = 3; /* put the wm in connected mode */ xrdp_wm_delete_all_childs(self); + self->dragging = 0; xrdp_mm_connect(self->mm); } else if (self->login_mode == 10) { xrdp_wm_delete_all_childs(self); + self->dragging = 0; self->login_mode = 11; } return 0;