Subversion Repositories Kolibri OS

Rev

Rev 5870 | Rev 9514 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5870 Rev 6585
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2010-2015. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2010-2015. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
7
 
8
$Revision: 5870 $
8
$Revision: 6585 $
9
 
9
 
10
include 'mousepointer.inc'
10
include 'mousepointer.inc'
11
 
11
 
12
;================================
12
;================================
13
;/////// public functions ///////
13
;/////// public functions ///////
14
;================================
14
;================================
15
 
15
 
16
mouse.LEFT_BUTTON_FLAG   = 0001b
16
mouse.LEFT_BUTTON_FLAG   = 0001b
17
mouse.RIGHT_BUTTON_FLAG  = 0010b
17
mouse.RIGHT_BUTTON_FLAG  = 0010b
18
mouse.MIDDLE_BUTTON_FLAG = 0100b
18
mouse.MIDDLE_BUTTON_FLAG = 0100b
19
 
19
 
20
mouse.BUTTONS_MASK = \
20
mouse.BUTTONS_MASK = \
21
  mouse.LEFT_BUTTON_FLAG or \
21
  mouse.LEFT_BUTTON_FLAG or \
22
  mouse.RIGHT_BUTTON_FLAG or \
22
  mouse.RIGHT_BUTTON_FLAG or \
23
  mouse.MIDDLE_BUTTON_FLAG
23
  mouse.MIDDLE_BUTTON_FLAG
24
 
24
 
25
mouse.WINDOW_RESIZE_N_FLAG = 000001b
25
mouse.WINDOW_RESIZE_N_FLAG = 000001b
26
mouse.WINDOW_RESIZE_W_FLAG = 000010b
26
mouse.WINDOW_RESIZE_W_FLAG = 000010b
27
mouse.WINDOW_RESIZE_S_FLAG = 000100b
27
mouse.WINDOW_RESIZE_S_FLAG = 000100b
28
mouse.WINDOW_RESIZE_E_FLAG = 001000b
28
mouse.WINDOW_RESIZE_E_FLAG = 001000b
29
mouse.WINDOW_MOVE_FLAG     = 010000b
29
mouse.WINDOW_MOVE_FLAG     = 010000b
30
 
30
 
31
mouse.WINDOW_RESIZE_SW_FLAG = \
31
mouse.WINDOW_RESIZE_SW_FLAG = \
32
  mouse.WINDOW_RESIZE_S_FLAG or \
32
  mouse.WINDOW_RESIZE_S_FLAG or \
33
  mouse.WINDOW_RESIZE_W_FLAG
33
  mouse.WINDOW_RESIZE_W_FLAG
34
mouse.WINDOW_RESIZE_SE_FLAG = \
34
mouse.WINDOW_RESIZE_SE_FLAG = \
35
  mouse.WINDOW_RESIZE_S_FLAG or \
35
  mouse.WINDOW_RESIZE_S_FLAG or \
36
  mouse.WINDOW_RESIZE_E_FLAG
36
  mouse.WINDOW_RESIZE_E_FLAG
37
 
37
 
38
align 4
38
align 4
39
;-----------------------------------------------------------------
39
;-----------------------------------------------------------------
40
mouse_check_events:
40
mouse_check_events:
41
; Check if mouse buttons state or cursor position has changed
41
; Check if mouse buttons state or cursor position has changed
42
        push    eax ebx
42
        push    eax ebx
43
        mov     al, [BTN_DOWN]
43
        mov     al, [BTN_DOWN]
44
        mov     bl, [mouse.state.buttons]
44
        mov     bl, [mouse.state.buttons]
45
        and     al, mouse.BUTTONS_MASK
45
        and     al, mouse.BUTTONS_MASK
46
        mov     cl, al
46
        mov     cl, al
47
        xchg    cl, [mouse.state.buttons]
47
        xchg    cl, [mouse.state.buttons]
48
        xor     bl, al
48
        xor     bl, al
49
        push    eax ebx
49
        push    eax ebx
50
 
50
 
51
        ; did any mouse button changed its state?
51
        ; did any mouse button changed its state?
52
        or      bl, bl
52
        or      bl, bl
53
        jz      .check_position
53
        jz      .check_position
54
 
54
 
55
        ; yes it did, is that the first button of all pressed down?
55
        ; yes it did, is that the first button of all pressed down?
56
        or      cl, cl
56
        or      cl, cl
57
        jnz     .check_buttons_released
57
        jnz     .check_buttons_released
58
 
58
 
59
        ; yes it is, activate window user is pointing at, if needed
59
        ; yes it is, activate window user is pointing at, if needed
60
        call    mouse._.activate_sys_window_under_cursor
60
        call    mouse._.activate_sys_window_under_cursor
61
 
-
 
62
; NOTE: this code wouldn't be necessary if we knew
-
 
63
; that window did already redraw itself after call above
-
 
64
        or      eax, eax
-
 
65
        jnz     .exit
-
 
66
 
61
 
67
        ; is there any system button under cursor?
62
        ; is there any system button under cursor?
68
        call    mouse._.find_sys_button_under_cursor
63
        call    mouse._.find_sys_button_under_cursor
69
        or      eax, eax
64
        or      eax, eax
70
        jz      .check_buttons_released
65
        jz      .check_buttons_released
71
 
66
 
72
        ; yes there is, activate it and exit
67
        ; yes there is, activate it and exit
73
        mov     [mouse.active_sys_button.pbid], eax
68
        mov     [mouse.active_sys_button.pbid], eax
74
        mov     [mouse.active_sys_button.coord], ebx
69
        mov     [mouse.active_sys_button.coord], ebx
75
        mov     cl, [mouse.state.buttons]
70
        mov     cl, [mouse.state.buttons]
76
        mov     [mouse.active_sys_button.buttons], cl
71
        mov     [mouse.active_sys_button.buttons], cl
77
        call    sys_button_activate_handler
72
        call    sys_button_activate_handler
78
        jmp     .exit
73
        jmp     .exit
79
 
74
 
80
  .check_buttons_released:
75
  .check_buttons_released:
81
        cmp     [mouse.state.buttons], 0
76
        cmp     [mouse.state.buttons], 0
82
        jnz     .buttons_changed
77
        jnz     .buttons_changed
83
 
78
 
84
        ; did we press some button earlier?
79
        ; did we press some button earlier?
85
        cmp     [mouse.active_sys_button.pbid], 0
80
        cmp     [mouse.active_sys_button.pbid], 0
86
        je      .buttons_changed
81
        je      .buttons_changed
87
 
82
 
88
        ; yes we did, deactivate it
83
        ; yes we did, deactivate it
89
        xor     eax, eax
84
        xor     eax, eax
90
        xchg    eax, [mouse.active_sys_button.pbid]
85
        xchg    eax, [mouse.active_sys_button.pbid]
91
        mov     ebx, [mouse.active_sys_button.coord]
86
        mov     ebx, [mouse.active_sys_button.coord]
92
        mov     cl, [mouse.active_sys_button.buttons]
87
        mov     cl, [mouse.active_sys_button.buttons]
93
        push    eax ebx
88
        push    eax ebx
94
        call    sys_button_deactivate_handler
89
        call    sys_button_deactivate_handler
95
        pop     edx ecx
90
        pop     edx ecx
96
 
91
 
97
        ; is the button under cursor the one we deactivated?
92
        ; is the button under cursor the one we deactivated?
98
        call    mouse._.find_sys_button_under_cursor
93
        call    mouse._.find_sys_button_under_cursor
99
        cmp     eax, ecx
94
        cmp     eax, ecx
100
        jne     .exit
95
        jne     .exit
101
        cmp     ebx, edx
96
        cmp     ebx, edx
102
        jne     .exit
97
        jne     .exit
103
 
98
 
104
        ; yes it is, perform associated action
99
        ; yes it is, perform associated action
105
        mov     cl, [mouse.active_sys_button.buttons]
100
        mov     cl, [mouse.active_sys_button.buttons]
106
        call    sys_button_perform_handler
101
        call    sys_button_perform_handler
107
        jmp     .exit
102
        jmp     .exit
108
 
103
 
109
  .buttons_changed:
104
  .buttons_changed:
110
        test    byte[esp], mouse.LEFT_BUTTON_FLAG
105
        test    byte[esp], mouse.LEFT_BUTTON_FLAG
111
        jz      @f
106
        jz      @f
112
        mov     eax, [esp + 4]
107
        mov     eax, [esp + 4]
113
        call    .call_left_button_handler
108
        call    .call_left_button_handler
114
 
109
 
115
    @@:
110
    @@:
116
        test    byte[esp], mouse.RIGHT_BUTTON_FLAG
111
        test    byte[esp], mouse.RIGHT_BUTTON_FLAG
117
        jz      @f
112
        jz      @f
118
        mov     eax, [esp + 4]
113
        mov     eax, [esp + 4]
119
        call    .call_right_button_handler
114
        call    .call_right_button_handler
120
 
115
 
121
    @@:
116
    @@:
122
        test    byte[esp], mouse.MIDDLE_BUTTON_FLAG
117
        test    byte[esp], mouse.MIDDLE_BUTTON_FLAG
123
        jz      .check_position
118
        jz      .check_position
124
        mov     eax, [esp + 4]
119
        mov     eax, [esp + 4]
125
        call    .call_middle_button_handler
120
        call    .call_middle_button_handler
126
 
121
 
127
  .check_position:
122
  .check_position:
128
        movzx   eax, word[MOUSE_X]
123
        movzx   eax, word[MOUSE_X]
129
        movzx   ebx, word[MOUSE_Y]
124
        movzx   ebx, word[MOUSE_Y]
130
        cmp     eax, [mouse.state.pos.x]
125
        cmp     eax, [mouse.state.pos.x]
131
        jne     .position_changed
126
        jne     .position_changed
132
        cmp     ebx, [mouse.state.pos.y]
127
        cmp     ebx, [mouse.state.pos.y]
133
        je      .exit
128
        je      .exit
134
 
129
 
135
  .position_changed:
130
  .position_changed:
136
        xchg    eax, [mouse.state.pos.x]
131
        xchg    eax, [mouse.state.pos.x]
137
        xchg    ebx, [mouse.state.pos.y]
132
        xchg    ebx, [mouse.state.pos.y]
138
 
133
 
139
        call    mouse._.move_handler
134
        call    mouse._.move_handler
140
 
135
 
141
  .exit:
136
  .exit:
142
        add     esp, 8
137
        add     esp, 8
143
        pop     ebx eax
138
        pop     ebx eax
144
        ret
139
        ret
145
 
140
 
146
  .call_left_button_handler:
141
  .call_left_button_handler:
147
        test    eax, mouse.LEFT_BUTTON_FLAG
142
        test    eax, mouse.LEFT_BUTTON_FLAG
148
        jnz     mouse._.left_button_press_handler
143
        jnz     mouse._.left_button_press_handler
149
        jmp     mouse._.left_button_release_handler
144
        jmp     mouse._.left_button_release_handler
150
 
145
 
151
  .call_right_button_handler:
146
  .call_right_button_handler:
152
        test    eax, mouse.RIGHT_BUTTON_FLAG
147
        test    eax, mouse.RIGHT_BUTTON_FLAG
153
        jnz     mouse._.right_button_press_handler
148
        jnz     mouse._.right_button_press_handler
154
        jmp     mouse._.right_button_release_handler
149
        jmp     mouse._.right_button_release_handler
155
 
150
 
156
  .call_middle_button_handler:
151
  .call_middle_button_handler:
157
        test    eax, mouse.MIDDLE_BUTTON_FLAG
152
        test    eax, mouse.MIDDLE_BUTTON_FLAG
158
        jnz     mouse._.middle_button_press_handler
153
        jnz     mouse._.middle_button_press_handler
159
        jmp     mouse._.middle_button_release_handler
154
        jmp     mouse._.middle_button_release_handler
160
 
155
 
161
;===============================
156
;===============================
162
;////// private functions //////
157
;////// private functions //////
163
;===============================
158
;===============================
164
 
159
 
165
uglobal
160
uglobal
166
  mouse.state:
161
  mouse.state:
167
    .pos     POINT
162
    .pos     POINT
168
    .buttons db ?
163
    .buttons db ?
169
 
164
 
170
; NOTE: since there's no unique and lifetime-constant button identifiers,
165
; NOTE: since there's no unique and lifetime-constant button identifiers,
171
; we are using two dwords to identify each of them:
166
; we are using two dwords to identify each of them:
172
;   * pbid - process slot (high 8 bits) and button id (low 24 bits) pack
167
;   * pbid - process slot (high 8 bits) and button id (low 24 bits) pack
173
;   * coord - left (high 16 bits) and top (low 16 bits) coordinates pack
168
;   * coord - left (high 16 bits) and top (low 16 bits) coordinates pack
174
  align 4
169
  align 4
175
  mouse.active_sys_button:
170
  mouse.active_sys_button:
176
    .pbid    dd ?
171
    .pbid    dd ?
177
    .coord   dd ?
172
    .coord   dd ?
178
    .buttons db ?
173
    .buttons db ?
179
 
174
 
180
  align 4
175
  align 4
181
  mouse.active_sys_window:
176
  mouse.active_sys_window:
182
    .pslot      dd ?
177
    .pslot      dd ?
183
    .old_box    BOX
178
    .old_box    BOX
184
    .new_box    BOX
179
    .new_box    BOX
185
    .delta      POINT
180
    .delta      POINT
186
    .last_ticks dd ?
181
    .last_ticks dd ?
187
    .action     db ?
182
    .action     db ?
188
endg
183
endg
189
 
184
 
190
iglobal
185
iglobal
191
        fl_moving db 0
186
        fl_moving db 0
192
        rb 3
187
        rb 3
193
endg
188
endg
194
 
189
 
195
align 4
190
align 4
196
;-----------------------------------------------------------------
191
;-----------------------------------------------------------------
197
mouse._.left_button_press_handler:
192
mouse._.left_button_press_handler:
198
; Called when left mouse button has been pressed down
193
; Called when left mouse button has been pressed down
199
        bts     word [BTN_DOWN], 8
194
        bts     word [BTN_DOWN], 8
200
        mov     eax, [timer_ticks]
195
        mov     eax, [timer_ticks]
201
        mov     ebx, eax
196
        mov     ebx, eax
202
        xchg    ebx, [mouse.active_sys_window.last_ticks]
197
        xchg    ebx, [mouse.active_sys_window.last_ticks]
203
        sub     eax, ebx
198
        sub     eax, ebx
204
        movzx   ebx, [mouse_doubleclick_delay]
199
        movzx   ebx, [mouse_doubleclick_delay]
205
        cmp     eax, ebx
200
        cmp     eax, ebx
206
        jg      @f
201
        jg      @f
207
        bts     dword [BTN_DOWN], 24
202
        bts     dword [BTN_DOWN], 24
208
@@:
203
@@:
209
        test    [mouse.state.buttons], not mouse.LEFT_BUTTON_FLAG
204
        test    [mouse.state.buttons], not mouse.LEFT_BUTTON_FLAG
210
        jnz     .exit
205
        jnz     .exit
211
 
206
 
212
        call    mouse._.find_sys_window_under_cursor
207
        call    mouse._.find_sys_window_under_cursor
213
        call    mouse._.check_sys_window_actions
208
        call    mouse._.check_sys_window_actions
214
        mov     [mouse.active_sys_window.action], al
209
        mov     [mouse.active_sys_window.action], al
215
        or      eax, eax
210
        or      eax, eax
216
        jz      .exit
211
        jz      .exit
217
 
212
 
218
        xchg    eax, edx
213
        xchg    eax, edx
219
        test    dl, mouse.WINDOW_MOVE_FLAG
214
        test    dl, mouse.WINDOW_MOVE_FLAG
220
        jz      @f
215
        jz      @f
221
 
216
 
222
        bt      dword [BTN_DOWN], 24
217
        bt      dword [BTN_DOWN], 24
223
        jnc     @f
218
        jnc     @f
224
 
219
 
225
        mov     [mouse.active_sys_window.last_ticks], 0
220
        mov     [mouse.active_sys_window.last_ticks], 0
226
        call    sys_window_maximize_handler
221
        call    sys_window_maximize_handler
227
        jmp     .exit
222
        jmp     .exit
228
 
223
 
229
    @@:
224
    @@:
230
        test    [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED
225
        test    [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED
231
        jnz     .exit
226
        jnz     .exit
232
        mov     [mouse.active_sys_window.pslot], esi
227
        mov     [mouse.active_sys_window.pslot], esi
233
        lea     eax, [edi + WDATA.box]
228
        lea     eax, [edi + WDATA.box]
234
        mov     ebx, mouse.active_sys_window.old_box
229
        mov     ebx, mouse.active_sys_window.old_box
235
        mov     ecx, sizeof.BOX
230
        mov     ecx, sizeof.BOX
236
        call    memmove
231
        call    memmove
237
        mov     ebx, mouse.active_sys_window.new_box
232
        mov     ebx, mouse.active_sys_window.new_box
238
        call    memmove
233
        call    memmove
239
        test    edx, mouse.WINDOW_MOVE_FLAG
234
        test    edx, mouse.WINDOW_MOVE_FLAG
240
        jz      @f
235
        jz      @f
241
 
236
 
242
        call    .calculate_n_delta
237
        call    .calculate_n_delta
243
        call    .calculate_w_delta
238
        call    .calculate_w_delta
244
        jmp     .call_window_handler
239
        jmp     .call_window_handler
245
 
240
 
246
    @@:
241
    @@:
247
        test    dl, mouse.WINDOW_RESIZE_W_FLAG
242
        test    dl, mouse.WINDOW_RESIZE_W_FLAG
248
        jz      @f
243
        jz      @f
249
        call    .calculate_w_delta
244
        call    .calculate_w_delta
250
 
245
 
251
    @@:
246
    @@:
252
        test    dl, mouse.WINDOW_RESIZE_S_FLAG
247
        test    dl, mouse.WINDOW_RESIZE_S_FLAG
253
        jz      @f
248
        jz      @f
254
        call    .calculate_s_delta
249
        call    .calculate_s_delta
255
 
250
 
256
    @@:
251
    @@:
257
        test    dl, mouse.WINDOW_RESIZE_E_FLAG
252
        test    dl, mouse.WINDOW_RESIZE_E_FLAG
258
        jz      .call_window_handler
253
        jz      .call_window_handler
259
        call    .calculate_e_delta
254
        call    .calculate_e_delta
260
 
255
 
261
  .call_window_handler:
256
  .call_window_handler:
262
  .exit:
257
  .exit:
263
        ret
258
        ret
264
 
259
 
265
  .calculate_n_delta:
260
  .calculate_n_delta:
266
        mov     eax, [mouse.state.pos.y]
261
        mov     eax, [mouse.state.pos.y]
267
        sub     eax, [mouse.active_sys_window.old_box.top]
262
        sub     eax, [mouse.active_sys_window.old_box.top]
268
        mov     [mouse.active_sys_window.delta.y], eax
263
        mov     [mouse.active_sys_window.delta.y], eax
269
        ret
264
        ret
270
 
265
 
271
  .calculate_w_delta:
266
  .calculate_w_delta:
272
        mov     eax, [mouse.state.pos.x]
267
        mov     eax, [mouse.state.pos.x]
273
        sub     eax, [mouse.active_sys_window.old_box.left]
268
        sub     eax, [mouse.active_sys_window.old_box.left]
274
        mov     [mouse.active_sys_window.delta.x], eax
269
        mov     [mouse.active_sys_window.delta.x], eax
275
        ret
270
        ret
276
 
271
 
277
  .calculate_s_delta:
272
  .calculate_s_delta:
278
        mov     eax, [mouse.active_sys_window.old_box.top]
273
        mov     eax, [mouse.active_sys_window.old_box.top]
279
        add     eax, [mouse.active_sys_window.old_box.height]
274
        add     eax, [mouse.active_sys_window.old_box.height]
280
        sub     eax, [mouse.state.pos.y]
275
        sub     eax, [mouse.state.pos.y]
281
        mov     [mouse.active_sys_window.delta.y], eax
276
        mov     [mouse.active_sys_window.delta.y], eax
282
        ret
277
        ret
283
 
278
 
284
  .calculate_e_delta:
279
  .calculate_e_delta:
285
        mov     eax, [mouse.active_sys_window.old_box.left]
280
        mov     eax, [mouse.active_sys_window.old_box.left]
286
        add     eax, [mouse.active_sys_window.old_box.width]
281
        add     eax, [mouse.active_sys_window.old_box.width]
287
        sub     eax, [mouse.state.pos.x]
282
        sub     eax, [mouse.state.pos.x]
288
        mov     [mouse.active_sys_window.delta.x], eax
283
        mov     [mouse.active_sys_window.delta.x], eax
289
        ret
284
        ret
290
 
285
 
291
align 4
286
align 4
292
;-----------------------------------------------------------------
287
;-----------------------------------------------------------------
293
mouse._.left_button_release_handler:
288
mouse._.left_button_release_handler:
294
; Called when left mouse button has been released
289
; Called when left mouse button has been released
295
        bts     dword [BTN_DOWN], 16
290
        bts     dword [BTN_DOWN], 16
296
        xor     esi, esi
291
        xor     esi, esi
297
        xchg    esi, [mouse.active_sys_window.pslot]
292
        xchg    esi, [mouse.active_sys_window.pslot]
298
        or      esi, esi
293
        or      esi, esi
299
        jz      .exit
294
        jz      .exit
300
 
295
 
301
        mov     eax, esi
296
        mov     eax, esi
302
        shl     eax, 5
297
        shl     eax, 5
303
        add     eax, window_data + WDATA.box
298
        add     eax, window_data + WDATA.box
304
        mov     ebx, mouse.active_sys_window.old_box
299
        mov     ebx, mouse.active_sys_window.old_box
305
        mov     ecx, sizeof.BOX
300
        mov     ecx, sizeof.BOX
306
        call    memmove
301
        call    memmove
307
 
302
 
308
        mov     eax, mouse.active_sys_window.old_box
303
        mov     eax, mouse.active_sys_window.old_box
309
        mov     ebx, mouse.active_sys_window.new_box
304
        mov     ebx, mouse.active_sys_window.new_box
310
        call    sys_window_end_moving_handler
305
        call    sys_window_end_moving_handler
311
 
306
 
312
  .exit:
307
  .exit:
313
        and     [mouse.active_sys_window.action], 0
308
        and     [mouse.active_sys_window.action], 0
314
        mov     [fl_moving], 0
309
        mov     [fl_moving], 0
315
        ret
310
        ret
316
 
311
 
317
mouse._.right_button_press_handler:
312
mouse._.right_button_press_handler:
318
        bts     word [BTN_DOWN], 9
313
        bts     word [BTN_DOWN], 9
319
        test    [mouse.state.buttons], not mouse.RIGHT_BUTTON_FLAG
314
        test    [mouse.state.buttons], not mouse.RIGHT_BUTTON_FLAG
320
        jnz     @f
315
        jnz     @f
321
        call    mouse._.find_sys_window_under_cursor
316
        call    mouse._.find_sys_window_under_cursor
322
        call    mouse._.check_sys_window_actions
317
        call    mouse._.check_sys_window_actions
323
        test    al, mouse.WINDOW_MOVE_FLAG
318
        test    al, mouse.WINDOW_MOVE_FLAG
324
        jz      @f
319
        jz      @f
325
        jmp     sys_window_rollup_handler
320
        jmp     sys_window_rollup_handler
326
 
321
 
327
mouse._.right_button_release_handler:
322
mouse._.right_button_release_handler:
328
        bts     dword [BTN_DOWN], 17
323
        bts     dword [BTN_DOWN], 17
329
@@:
324
@@:
330
        ret
325
        ret
331
 
326
 
332
mouse._.middle_button_press_handler:
327
mouse._.middle_button_press_handler:
333
        bts     word [BTN_DOWN], 10
328
        bts     word [BTN_DOWN], 10
334
        ret
329
        ret
335
 
330
 
336
mouse._.middle_button_release_handler:
331
mouse._.middle_button_release_handler:
337
        bts     dword [BTN_DOWN], 18
332
        bts     dword [BTN_DOWN], 18
338
        ret
333
        ret
339
 
334
 
340
align 4
335
align 4
341
;-----------------------------------------------------------------
336
;-----------------------------------------------------------------
342
mouse._.move_handler:
337
mouse._.move_handler:
343
; Called when cursor has been moved
338
; Called when cursor has been moved
344
;> eax = old x coord
339
;> eax = old x coord
345
;> ebx = old y coord
340
;> ebx = old y coord
346
        cmp     [mouse.active_sys_button.pbid], 0
341
        cmp     [mouse.active_sys_button.pbid], 0
347
        jnz     .exit
342
        jnz     .exit
348
 
343
 
349
        mov     esi, [mouse.active_sys_window.pslot]
344
        mov     esi, [mouse.active_sys_window.pslot]
350
        or      esi, esi
345
        or      esi, esi
351
        jz      .exit
346
        jz      .exit
352
 
347
 
353
        mov     eax, mouse.active_sys_window.new_box
348
        mov     eax, mouse.active_sys_window.new_box
354
        mov     ebx, mouse.active_sys_window.old_box
349
        mov     ebx, mouse.active_sys_window.old_box
355
        mov     ecx, sizeof.BOX
350
        mov     ecx, sizeof.BOX
356
        call    memmove
351
        call    memmove
357
 
352
 
358
        mov     dl, [mouse.active_sys_window.action]
353
        mov     dl, [mouse.active_sys_window.action]
359
        test    dl, mouse.WINDOW_MOVE_FLAG
354
        test    dl, mouse.WINDOW_MOVE_FLAG
360
        jz      .check_resize_w
355
        jz      .check_resize_w
361
 
356
 
362
        mov     eax, [mouse.state.pos.x]
357
        mov     eax, [mouse.state.pos.x]
363
        sub     eax, [mouse.active_sys_window.delta.x]
358
        sub     eax, [mouse.active_sys_window.delta.x]
364
        mov     [mouse.active_sys_window.new_box.left], eax
359
        mov     [mouse.active_sys_window.new_box.left], eax
365
        mov     eax, [mouse.state.pos.y]
360
        mov     eax, [mouse.state.pos.y]
366
        sub     eax, [mouse.active_sys_window.delta.y]
361
        sub     eax, [mouse.active_sys_window.delta.y]
367
        mov     [mouse.active_sys_window.new_box.top], eax
362
        mov     [mouse.active_sys_window.new_box.top], eax
368
 
363
 
369
        mov     eax, [mouse.active_sys_window.new_box.left]
364
        mov     eax, [mouse.active_sys_window.new_box.left]
370
        or      eax, eax
365
        or      eax, eax
371
        jge     @f
366
        jge     @f
372
        xor     eax, eax
367
        xor     eax, eax
373
        mov     [mouse.active_sys_window.new_box.left], eax
368
        mov     [mouse.active_sys_window.new_box.left], eax
374
    @@:
369
    @@:
375
        add     eax, [mouse.active_sys_window.new_box.width]
370
        add     eax, [mouse.active_sys_window.new_box.width]
376
        cmp     eax, [_display.width]
371
        cmp     eax, [_display.width]
377
        jl      @f
372
        jl      @f
378
        sub     eax, [_display.width]
373
        sub     eax, [_display.width]
379
        sub     [mouse.active_sys_window.new_box.left], eax
374
        sub     [mouse.active_sys_window.new_box.left], eax
380
    @@:
375
    @@:
381
        mov     eax, [mouse.active_sys_window.new_box.top]
376
        mov     eax, [mouse.active_sys_window.new_box.top]
382
        or      eax, eax
377
        or      eax, eax
383
        jge     @f
378
        jge     @f
384
        xor     eax, eax
379
        xor     eax, eax
385
        mov     [mouse.active_sys_window.new_box.top], eax
380
        mov     [mouse.active_sys_window.new_box.top], eax
386
    @@:
381
    @@:
387
        add     eax, [mouse.active_sys_window.new_box.height]
382
        add     eax, [mouse.active_sys_window.new_box.height]
388
        cmp     eax, [_display.height]
383
        cmp     eax, [_display.height]
389
        jl      .call_window_handler
384
        jl      .call_window_handler
390
        sub     eax, [_display.height]
385
        sub     eax, [_display.height]
391
        sub     [mouse.active_sys_window.new_box.top], eax
386
        sub     [mouse.active_sys_window.new_box.top], eax
392
        jmp     .call_window_handler
387
        jmp     .call_window_handler
393
 
388
 
394
  .check_resize_w:
389
  .check_resize_w:
395
        test    dl, mouse.WINDOW_RESIZE_W_FLAG
390
        test    dl, mouse.WINDOW_RESIZE_W_FLAG
396
        jz      .check_resize_s
391
        jz      .check_resize_s
397
 
392
 
398
        mov     eax, [mouse.state.pos.x]
393
        mov     eax, [mouse.state.pos.x]
399
        sub     eax, [mouse.active_sys_window.delta.x]
394
        sub     eax, [mouse.active_sys_window.delta.x]
400
        mov     [mouse.active_sys_window.new_box.left], eax
395
        mov     [mouse.active_sys_window.new_box.left], eax
401
        sub     eax, [mouse.active_sys_window.old_box.left]
396
        sub     eax, [mouse.active_sys_window.old_box.left]
402
        sub     [mouse.active_sys_window.new_box.width], eax
397
        sub     [mouse.active_sys_window.new_box.width], eax
403
 
398
 
404
        mov     eax, [mouse.active_sys_window.new_box.width]
399
        mov     eax, [mouse.active_sys_window.new_box.width]
405
        sub     eax, 127
400
        sub     eax, 127
406
        jge     @f
401
        jge     @f
407
        add     [mouse.active_sys_window.new_box.left], eax
402
        add     [mouse.active_sys_window.new_box.left], eax
408
        mov     [mouse.active_sys_window.new_box.width], 127
403
        mov     [mouse.active_sys_window.new_box.width], 127
409
    @@:
404
    @@:
410
        mov     eax, [mouse.active_sys_window.new_box.left]
405
        mov     eax, [mouse.active_sys_window.new_box.left]
411
        or      eax, eax
406
        or      eax, eax
412
        jge     .check_resize_s
407
        jge     .check_resize_s
413
        add     [mouse.active_sys_window.new_box.width], eax
408
        add     [mouse.active_sys_window.new_box.width], eax
414
        xor     eax, eax
409
        xor     eax, eax
415
        mov     [mouse.active_sys_window.new_box.left], eax
410
        mov     [mouse.active_sys_window.new_box.left], eax
416
 
411
 
417
  .check_resize_s:
412
  .check_resize_s:
418
        test    dl, mouse.WINDOW_RESIZE_S_FLAG
413
        test    dl, mouse.WINDOW_RESIZE_S_FLAG
419
        jz      .check_resize_e
414
        jz      .check_resize_e
420
 
415
 
421
        mov     eax, [mouse.state.pos.y]
416
        mov     eax, [mouse.state.pos.y]
422
        add     eax, [mouse.active_sys_window.delta.y]
417
        add     eax, [mouse.active_sys_window.delta.y]
423
        sub     eax, [mouse.active_sys_window.old_box.top]
418
        sub     eax, [mouse.active_sys_window.old_box.top]
424
        mov     [mouse.active_sys_window.new_box.height], eax
419
        mov     [mouse.active_sys_window.new_box.height], eax
425
 
420
 
426
        push    eax
421
        push    eax
427
        mov     edi, esi
422
        mov     edi, esi
428
        shl     edi, 5
423
        shl     edi, 5
429
        add     edi, window_data
424
        add     edi, window_data
430
        call    window._.get_rolledup_height
425
        call    window._.get_rolledup_height
431
        mov     ecx, eax
426
        mov     ecx, eax
432
        pop     eax
427
        pop     eax
433
        mov     eax, [mouse.active_sys_window.new_box.height]
428
        mov     eax, [mouse.active_sys_window.new_box.height]
434
        cmp     eax, ecx
429
        cmp     eax, ecx
435
        jge     @f
430
        jge     @f
436
        mov     eax, ecx
431
        mov     eax, ecx
437
        mov     [mouse.active_sys_window.new_box.height], eax
432
        mov     [mouse.active_sys_window.new_box.height], eax
438
    @@:
433
    @@:
439
        add     eax, [mouse.active_sys_window.new_box.top]
434
        add     eax, [mouse.active_sys_window.new_box.top]
440
        cmp     eax, [_display.height]
435
        cmp     eax, [_display.height]
441
        jl      .check_resize_e
436
        jl      .check_resize_e
442
        sub     eax, [_display.height]
437
        sub     eax, [_display.height]
443
        neg     eax
438
        neg     eax
444
        add     [mouse.active_sys_window.new_box.height], eax
439
        add     [mouse.active_sys_window.new_box.height], eax
445
        mov     ecx, [_display.height]
440
        mov     ecx, [_display.height]
446
        cmp     ecx, eax
441
        cmp     ecx, eax
447
        jg      .check_resize_e
442
        jg      .check_resize_e
448
        mov     [mouse.active_sys_window.new_box.height], ecx
443
        mov     [mouse.active_sys_window.new_box.height], ecx
449
 
444
 
450
  .check_resize_e:
445
  .check_resize_e:
451
        test    dl, mouse.WINDOW_RESIZE_E_FLAG
446
        test    dl, mouse.WINDOW_RESIZE_E_FLAG
452
        jz      .call_window_handler
447
        jz      .call_window_handler
453
 
448
 
454
        mov     eax, [mouse.state.pos.x]
449
        mov     eax, [mouse.state.pos.x]
455
        add     eax, [mouse.active_sys_window.delta.x]
450
        add     eax, [mouse.active_sys_window.delta.x]
456
        sub     eax, [mouse.active_sys_window.old_box.left]
451
        sub     eax, [mouse.active_sys_window.old_box.left]
457
        mov     [mouse.active_sys_window.new_box.width], eax
452
        mov     [mouse.active_sys_window.new_box.width], eax
458
 
453
 
459
        mov     eax, [mouse.active_sys_window.new_box.width]
454
        mov     eax, [mouse.active_sys_window.new_box.width]
460
        cmp     eax, 127
455
        cmp     eax, 127
461
        jge     @f
456
        jge     @f
462
        mov     eax, 127
457
        mov     eax, 127
463
        mov     [mouse.active_sys_window.new_box.width], eax
458
        mov     [mouse.active_sys_window.new_box.width], eax
464
    @@:
459
    @@:
465
        add     eax, [mouse.active_sys_window.new_box.left]
460
        add     eax, [mouse.active_sys_window.new_box.left]
466
        cmp     eax, [_display.width]
461
        cmp     eax, [_display.width]
467
        jl      .call_window_handler
462
        jl      .call_window_handler
468
        sub     eax, [_display.width]
463
        sub     eax, [_display.width]
469
        neg     eax
464
        neg     eax
470
        add     [mouse.active_sys_window.new_box.width], eax
465
        add     [mouse.active_sys_window.new_box.width], eax
471
        mov     ecx, [_display.width]
466
        mov     ecx, [_display.width]
472
        cmp     ecx, eax
467
        cmp     ecx, eax
473
        jg      .call_window_handler
468
        jg      .call_window_handler
474
        mov     [mouse.active_sys_window.new_box.width], ecx
469
        mov     [mouse.active_sys_window.new_box.width], ecx
475
 
470
 
476
  .call_window_handler:
471
  .call_window_handler:
477
        mov     eax, mouse.active_sys_window.old_box
472
        mov     eax, mouse.active_sys_window.old_box
478
        mov     ebx, mouse.active_sys_window.new_box
473
        mov     ebx, mouse.active_sys_window.new_box
479
 
474
 
480
        push    esi
475
        push    esi
481
        mov     esi, mouse.active_sys_window.old_box
476
        mov     esi, mouse.active_sys_window.old_box
482
        mov     edi, mouse.active_sys_window.new_box
477
        mov     edi, mouse.active_sys_window.new_box
483
        mov     ecx, sizeof.BOX / 4
478
        mov     ecx, sizeof.BOX / 4
484
        repe
479
        repe
485
        cmpsd
480
        cmpsd
486
        pop     esi
481
        pop     esi
487
        je      .exit
482
        je      .exit
488
 
483
 
489
        test    [fl_moving], 1
484
        test    [fl_moving], 1
490
        jnz     @f
485
        jnz     @f
491
 
486
 
492
        mov     [fl_moving], 1
487
        mov     [fl_moving], 1
493
        push    edi
488
        push    edi
494
        mov     edi, esi
489
        mov     edi, esi
495
        shl     edi, 5
490
        shl     edi, 5
496
        add     edi, WDATA.box + window_data
491
        add     edi, WDATA.box + window_data
497
        call    window._.draw_negative_box
492
        call    window._.draw_negative_box
498
        pop     edi
493
        pop     edi
499
     @@:
494
     @@:
500
 
495
 
501
 
496
 
502
        mov     [mouse.active_sys_window.last_ticks], 0
497
        mov     [mouse.active_sys_window.last_ticks], 0
503
        call    sys_window_moving_handler
498
        call    sys_window_moving_handler
504
 
499
 
505
  .exit:
500
  .exit:
506
        ret
501
        ret
507
 
502
 
508
align 4
503
align 4
509
;-----------------------------------------------------------------
504
;-----------------------------------------------------------------
510
mouse._.find_sys_window_under_cursor:
505
mouse._.find_sys_window_under_cursor:
511
; Find system window object which is currently visible on screen
506
; Find system window object which is currently visible on screen
512
; and has mouse cursor within its bounds
507
; and has mouse cursor within its bounds
513
;< esi = process slot
508
;< esi = process slot
514
;< edi = pointer to WDATA struct
509
;< edi = pointer to WDATA struct
515
        mov     esi, [mouse.state.pos.y]
510
        mov     esi, [mouse.state.pos.y]
516
        mov     esi, [d_width_calc_area + esi*4]
511
        mov     esi, [d_width_calc_area + esi*4]
517
 
512
 
518
        add     esi, [_display.win_map]
513
        add     esi, [_display.win_map]
519
        add     esi, [mouse.state.pos.x]
514
        add     esi, [mouse.state.pos.x]
520
        movzx   esi, byte[esi]
515
        movzx   esi, byte[esi]
521
        mov     edi, esi
516
        mov     edi, esi
522
        shl     edi, 5
517
        shl     edi, 5
523
        add     edi, window_data
518
        add     edi, window_data
524
        ret
519
        ret
525
 
520
 
526
align 4
521
align 4
527
;-----------------------------------------------------------------
522
;-----------------------------------------------------------------
528
mouse._.activate_sys_window_under_cursor:
523
mouse._.activate_sys_window_under_cursor:
529
; activate and redraw window under cursor (if necessary)
524
; activate and redraw window under cursor (if necessary)
530
        call    mouse._.find_sys_window_under_cursor
525
        call    mouse._.find_sys_window_under_cursor
531
        movzx   esi, word[WIN_STACK + esi * 2]
526
        movzx   esi, word[WIN_STACK + esi * 2]
532
        lea     esi, [WIN_POS + esi * 2]
527
        lea     esi, [WIN_POS + esi * 2]
533
        jmp     waredraw
528
        jmp     waredraw
534
 
529
 
535
align 4
530
align 4
536
;-----------------------------------------------------------------
531
;-----------------------------------------------------------------
537
mouse._.find_sys_button_under_cursor:
532
mouse._.find_sys_button_under_cursor:
538
; Find system button object which is currently visible on screen
533
; Find system button object which is currently visible on screen
539
; and has mouse cursor within its bounds
534
; and has mouse cursor within its bounds
540
;< eax = pack[8(process slot), 24(button id)] or 0
535
;< eax = pack[8(process slot), 24(button id)] or 0
541
;< ebx = pack[16(button x coord), 16(button y coord)]
536
;< ebx = pack[16(button x coord), 16(button y coord)]
542
        push    ecx edx esi edi
537
        push    ecx edx esi edi
543
 
538
 
544
        call    mouse._.find_sys_window_under_cursor
539
        call    mouse._.find_sys_window_under_cursor
545
        mov     edx, esi
540
        mov     edx, esi
546
 
541
 
547
        ; check if any process button contains cursor
542
        ; check if any process button contains cursor
548
        mov     eax, [BTN_ADDR]
543
        mov     eax, [BTN_ADDR]
549
        mov     ecx, [eax]
544
        mov     ecx, [eax]
550
        imul    esi, ecx, sizeof.SYS_BUTTON
545
        imul    esi, ecx, sizeof.SYS_BUTTON
551
        add     esi, eax
546
        add     esi, eax
552
        inc     ecx
547
        inc     ecx
553
        add     esi, sizeof.SYS_BUTTON
548
        add     esi, sizeof.SYS_BUTTON
554
 
549
 
555
  .next_button:
550
  .next_button:
556
        dec     ecx
551
        dec     ecx
557
        jz      .not_found
552
        jz      .not_found
558
 
553
 
559
        add     esi, -sizeof.SYS_BUTTON
554
        add     esi, -sizeof.SYS_BUTTON
560
 
555
 
561
        ; does it belong to our process?
556
        ; does it belong to our process?
562
        cmp     dx, [esi + SYS_BUTTON.pslot]
557
        cmp     dx, [esi + SYS_BUTTON.pslot]
563
        jne     .next_button
558
        jne     .next_button
564
 
559
 
565
        ; does it contain cursor coordinates?
560
        ; does it contain cursor coordinates?
566
        mov     eax, [mouse.state.pos.x]
561
        mov     eax, [mouse.state.pos.x]
567
        sub     eax, [edi + WDATA.box.left]
562
        sub     eax, [edi + WDATA.box.left]
568
        sub     ax, [esi + SYS_BUTTON.left]
563
        sub     ax, [esi + SYS_BUTTON.left]
569
        jl      .next_button
564
        jl      .next_button
570
        sub     ax, [esi + SYS_BUTTON.width]
565
        sub     ax, [esi + SYS_BUTTON.width]
571
        jge     .next_button
566
        jge     .next_button
572
        mov     eax, [mouse.state.pos.y]
567
        mov     eax, [mouse.state.pos.y]
573
        sub     eax, [edi + WDATA.box.top]
568
        sub     eax, [edi + WDATA.box.top]
574
        sub     ax, [esi + SYS_BUTTON.top]
569
        sub     ax, [esi + SYS_BUTTON.top]
575
        jl      .next_button
570
        jl      .next_button
576
        sub     ax, [esi + SYS_BUTTON.height]
571
        sub     ax, [esi + SYS_BUTTON.height]
577
        jge     .next_button
572
        jge     .next_button
578
 
573
 
579
        ; okay, return it
574
        ; okay, return it
580
        shl     edx, 24
575
        shl     edx, 24
581
        mov     eax, dword[esi + SYS_BUTTON.id_hi - 2]
576
        mov     eax, dword[esi + SYS_BUTTON.id_hi - 2]
582
        mov     ax, [esi + SYS_BUTTON.id_lo]
577
        mov     ax, [esi + SYS_BUTTON.id_lo]
583
        and     eax, 0x0ffffff
578
        and     eax, 0x0ffffff
584
        or      eax, edx
579
        or      eax, edx
585
        mov     ebx, dword[esi + SYS_BUTTON.left - 2]
580
        mov     ebx, dword[esi + SYS_BUTTON.left - 2]
586
        mov     bx, [esi + SYS_BUTTON.top]
581
        mov     bx, [esi + SYS_BUTTON.top]
587
        jmp     .exit
582
        jmp     .exit
588
 
583
 
589
  .not_found:
584
  .not_found:
590
        xor     eax, eax
585
        xor     eax, eax
591
        xor     ebx, ebx
586
        xor     ebx, ebx
592
 
587
 
593
  .exit:
588
  .exit:
594
        pop     edi esi edx ecx
589
        pop     edi esi edx ecx
595
        ret
590
        ret
596
 
591
 
597
align 4
592
align 4
598
;-----------------------------------------------------------------
593
;-----------------------------------------------------------------
599
mouse._.check_sys_window_actions:
594
mouse._.check_sys_window_actions:
600
;< eax = action flags or 0
595
;< eax = action flags or 0
601
        ; is window movable?
596
        ; is window movable?
602
        test    byte[edi + WDATA.cl_titlebar + 3], 0x01
597
        test    byte[edi + WDATA.cl_titlebar + 3], 0x01
603
        jnz     .no_action
598
        jnz     .no_action
604
 
599
 
605
        mov     eax, [mouse.state.pos.x]
600
        mov     eax, [mouse.state.pos.x]
606
        mov     ebx, [mouse.state.pos.y]
601
        mov     ebx, [mouse.state.pos.y]
607
        sub     eax, [edi + WDATA.box.left]
602
        sub     eax, [edi + WDATA.box.left]
608
        sub     ebx, [edi + WDATA.box.top]
603
        sub     ebx, [edi + WDATA.box.top]
609
 
604
 
610
        ; is there a window titlebar under cursor?
605
        ; is there a window titlebar under cursor?
611
        push    eax
606
        push    eax
612
        call    window._.get_titlebar_height
607
        call    window._.get_titlebar_height
613
        cmp     ebx, eax
608
        cmp     ebx, eax
614
        pop     eax
609
        pop     eax
615
        jl      .move_action
610
        jl      .move_action
616
 
611
 
617
        ; no there isn't, can it be resized then?
612
        ; no there isn't, can it be resized then?
618
        mov     dl, [edi + WDATA.fl_wstyle]
613
        mov     dl, [edi + WDATA.fl_wstyle]
619
        and     dl, 0x0f
614
        and     dl, 0x0f
620
; NOTE: dangerous optimization, revise if window types changed
615
; NOTE: dangerous optimization, revise if window types changed
621
; this currently implies only types 2 and 3 could be resized
616
; this currently implies only types 2 and 3 could be resized
622
        test    dl, 2
617
        test    dl, 2
623
        jz      .no_action
618
        jz      .no_action
624
 
619
 
625
        mov     ecx, [edi + WDATA.box.width]
620
        mov     ecx, [edi + WDATA.box.width]
626
        add     ecx, -window.BORDER_SIZE
621
        add     ecx, -window.BORDER_SIZE
627
        mov     edx, [edi + WDATA.box.height]
622
        mov     edx, [edi + WDATA.box.height]
628
        add     edx, -window.BORDER_SIZE
623
        add     edx, -window.BORDER_SIZE
629
 
624
 
630
        ; is it rolled up?
625
        ; is it rolled up?
631
        test    [edi + WDATA.fl_wstate], WSTATE_ROLLEDUP
626
        test    [edi + WDATA.fl_wstate], WSTATE_ROLLEDUP
632
        jnz     .resize_w_or_e_action
627
        jnz     .resize_w_or_e_action
633
 
628
 
634
        cmp     eax, window.BORDER_SIZE
629
        cmp     eax, window.BORDER_SIZE
635
        jl      .resize_w_action
630
        jl      .resize_w_action
636
        cmp     eax, ecx
631
        cmp     eax, ecx
637
        jg      .resize_e_action
632
        jg      .resize_e_action
638
        cmp     ebx, edx
633
        cmp     ebx, edx
639
        jle     .no_action
634
        jle     .no_action
640
 
635
 
641
  .resize_s_action:
636
  .resize_s_action:
642
        cmp     eax, window.BORDER_SIZE + 10
637
        cmp     eax, window.BORDER_SIZE + 10
643
        jl      .resize_sw_action
638
        jl      .resize_sw_action
644
        add     ecx, -10
639
        add     ecx, -10
645
        cmp     eax, ecx
640
        cmp     eax, ecx
646
        jge     .resize_se_action
641
        jge     .resize_se_action
647
        mov     eax, mouse.WINDOW_RESIZE_S_FLAG
642
        mov     eax, mouse.WINDOW_RESIZE_S_FLAG
648
        jmp     .exit
643
        jmp     .exit
649
 
644
 
650
  .resize_w_or_e_action:
645
  .resize_w_or_e_action:
651
        cmp     eax, window.BORDER_SIZE + 10
646
        cmp     eax, window.BORDER_SIZE + 10
652
        jl      .resize_w_action.direct
647
        jl      .resize_w_action.direct
653
        add     ecx, -10
648
        add     ecx, -10
654
        cmp     eax, ecx
649
        cmp     eax, ecx
655
        jg      .resize_e_action.direct
650
        jg      .resize_e_action.direct
656
        jmp     .no_action
651
        jmp     .no_action
657
 
652
 
658
  .resize_w_action:
653
  .resize_w_action:
659
        add     edx, -10
654
        add     edx, -10
660
        cmp     ebx, edx
655
        cmp     ebx, edx
661
        jge     .resize_sw_action
656
        jge     .resize_sw_action
662
  .resize_w_action.direct:
657
  .resize_w_action.direct:
663
        mov     eax, mouse.WINDOW_RESIZE_W_FLAG
658
        mov     eax, mouse.WINDOW_RESIZE_W_FLAG
664
        jmp     .exit
659
        jmp     .exit
665
 
660
 
666
  .resize_e_action:
661
  .resize_e_action:
667
        add     edx, -10
662
        add     edx, -10
668
        cmp     ebx, edx
663
        cmp     ebx, edx
669
        jge     .resize_se_action
664
        jge     .resize_se_action
670
  .resize_e_action.direct:
665
  .resize_e_action.direct:
671
        mov     eax, mouse.WINDOW_RESIZE_E_FLAG
666
        mov     eax, mouse.WINDOW_RESIZE_E_FLAG
672
        jmp     .exit
667
        jmp     .exit
673
 
668
 
674
  .resize_sw_action:
669
  .resize_sw_action:
675
        mov     eax, mouse.WINDOW_RESIZE_SW_FLAG
670
        mov     eax, mouse.WINDOW_RESIZE_SW_FLAG
676
        jmp     .exit
671
        jmp     .exit
677
 
672
 
678
  .resize_se_action:
673
  .resize_se_action:
679
        mov     eax, mouse.WINDOW_RESIZE_SE_FLAG
674
        mov     eax, mouse.WINDOW_RESIZE_SE_FLAG
680
        jmp     .exit
675
        jmp     .exit
681
 
676
 
682
  .move_action:
677
  .move_action:
683
        mov     eax, mouse.WINDOW_MOVE_FLAG
678
        mov     eax, mouse.WINDOW_MOVE_FLAG
684
        jmp     .exit
679
        jmp     .exit
685
 
680
 
686
  .no_action:
681
  .no_action:
687
        xor     eax, eax
682
        xor     eax, eax
688
 
683
 
689
  .exit:
684
  .exit:
690
        ret
685
        ret