Subversion Repositories Kolibri OS

Rev

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

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