Rev 5680 | Rev 5720 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5663 | hidnplayr | 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
||
3 | ;; Copyright (C) KolibriOS team 2010-2015. All rights reserved. ;; |
||
4 | ;; Distributed under terms of the GNU General Public License ;; |
||
5 | ;; ;; |
||
6 | ;; VNC client for KolibriOS ;; |
||
7 | ;; ;; |
||
8 | ;; Written by hidnplayr@kolibrios.org ;; |
||
9 | ;; ;; |
||
10 | ;; GNU GENERAL PUBLIC LICENSE ;; |
||
11 | ;; Version 2, June 1991 ;; |
||
12 | ;; ;; |
||
13 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
3545 | hidnplayr | 14 | |
5668 | hidnplayr | 15 | draw_gui: |
5663 | hidnplayr | 16 | mcall 40, EVM_MOUSE + EVM_MOUSE_FILTER + EVM_REDRAW + EVM_BUTTON + EVM_KEY |
3545 | hidnplayr | 17 | |
5663 | hidnplayr | 18 | .redraw: |
5668 | hidnplayr | 19 | mcall 12, 1 ; start window draw |
5663 | hidnplayr | 20 | ; DRAW WINDOW |
21 | xor eax, eax ; function 0 _logon: define and draw window |
||
22 | mov ebx, 160 shl 16 + 330 ; [x start]:[x size] |
||
23 | mov ecx, 160 shl 16 + 100 ; [y start]:[y size] |
||
24 | mov edx, 0x34DDDDDD ; color of work area RRGGBB |
||
25 | mov edi, name ; WINDOW LABEL |
||
26 | mcall |
||
3545 | hidnplayr | 27 | |
5670 | hidnplayr | 28 | cmp [status], STATUS_CONNECTING |
29 | ja @f |
||
5668 | hidnplayr | 30 | |
5693 | hidnplayr | 31 | mov ebx, 25 shl 16 + 24 |
5668 | hidnplayr | 32 | xor ecx, ecx |
33 | mov edx, serverstr |
||
34 | mov esi, userstr-serverstr |
||
35 | mcall 4 ; "server" text |
||
36 | |||
37 | invoke edit_box_draw, URLbox ; Server textbox |
||
38 | |||
5670 | hidnplayr | 39 | cmp [status], STATUS_INITIAL |
40 | jne .redraw_done |
||
41 | |||
5663 | hidnplayr | 42 | mov ebx, 220 shl 16 + 85 |
43 | mov ecx, 47 shl 16 + 16 |
||
44 | mov edx, 2 |
||
45 | mov esi, 0xCCCCCC |
||
5668 | hidnplayr | 46 | mcall 8 ; Connect button |
3545 | hidnplayr | 47 | |
5670 | hidnplayr | 48 | mov ebx, 240 shl 16 + 52 |
5668 | hidnplayr | 49 | mov edx, connectstr |
50 | mov esi, loginstr-connectstr |
||
51 | mcall 4 ; Connect button text |
||
3545 | hidnplayr | 52 | |
5668 | hidnplayr | 53 | jmp .redraw_done |
54 | |||
55 | @@: |
||
56 | cmp [status], STATUS_LOGIN |
||
5670 | hidnplayr | 57 | ja @f |
5668 | hidnplayr | 58 | |
5670 | hidnplayr | 59 | mov ebx, 25 shl 16 + 14 |
5663 | hidnplayr | 60 | xor ecx, ecx |
5668 | hidnplayr | 61 | mov edx, userstr |
62 | mov esi, passstr-userstr |
||
63 | mcall 4 ; "user" text |
||
3545 | hidnplayr | 64 | |
5670 | hidnplayr | 65 | add bl, 20 |
5668 | hidnplayr | 66 | mov edx, passstr |
67 | mov esi, connectstr-passstr ; "password" text |
||
5663 | hidnplayr | 68 | mcall |
3545 | hidnplayr | 69 | |
5670 | hidnplayr | 70 | invoke edit_box_draw, USERbox ; username textbox |
71 | invoke edit_box_draw, PASSbox ; password textbox |
||
72 | |||
73 | cmp [status], STATUS_REQ_LOGIN |
||
74 | jne .redraw_done |
||
75 | |||
5668 | hidnplayr | 76 | mov ebx, 220 shl 16 + 85 |
77 | mov ecx, 47 shl 16 + 16 |
||
78 | mov edx, 3 |
||
79 | mov esi, 0xCCCCCC |
||
80 | mcall 8 ; Login button |
||
3545 | hidnplayr | 81 | |
5680 | hidnplayr | 82 | mov ebx, 240 shl 16 + 52 |
5668 | hidnplayr | 83 | mov edx, loginstr |
84 | mov esi, loginstr_e-loginstr |
||
85 | mcall 4 ; Login button text |
||
3545 | hidnplayr | 86 | |
5668 | hidnplayr | 87 | jmp .redraw_done |
3545 | hidnplayr | 88 | |
5668 | hidnplayr | 89 | @@: |
5670 | hidnplayr | 90 | cmp [status], STATUS_DISCONNECTED |
91 | jb .redraw_done |
||
92 | |||
5668 | hidnplayr | 93 | mov ebx, 25 shl 16 + 15 |
94 | mov ecx, 0x80ca0000 ; red ASCIIZ string |
||
95 | mov edx, [status] |
||
96 | sub edx, 10 |
||
97 | mov edx, [err_msg+4*edx] |
||
98 | mcall 4 ; print error message to window |
||
3545 | hidnplayr | 99 | |
5668 | hidnplayr | 100 | .redraw_done: |
101 | mov [update_gui], 0 |
||
102 | mcall 12, 2 |
||
3545 | hidnplayr | 103 | |
5663 | hidnplayr | 104 | .loop: |
5668 | hidnplayr | 105 | cmp [update_gui], 0 |
106 | jne .redraw |
||
107 | cmp [status], STATUS_CONNECTED |
||
108 | je .connected |
||
109 | |||
110 | mcall 23, 10 ; wait for event |
||
111 | dec eax ; redraw request ? |
||
5663 | hidnplayr | 112 | jz .redraw |
5668 | hidnplayr | 113 | dec eax ; key in buffer ? |
5663 | hidnplayr | 114 | jz .key |
5668 | hidnplayr | 115 | dec eax ; button in buffer ? |
5663 | hidnplayr | 116 | jz .btn |
117 | sub eax, 3 |
||
118 | jz .mouse |
||
119 | jmp .loop |
||
3545 | hidnplayr | 120 | |
5668 | hidnplayr | 121 | .connected: |
122 | ret |
||
3545 | hidnplayr | 123 | |
5668 | hidnplayr | 124 | .key: ; key event handler |
125 | mcall 2 ; read key |
||
126 | |||
127 | cmp [status], STATUS_INITIAL |
||
128 | jne @f |
||
5663 | hidnplayr | 129 | test [URLbox.flags], ed_focus |
130 | jz mainloop |
||
5668 | hidnplayr | 131 | cmp ah, 13 ; enter (return) key |
132 | je .connect |
||
5663 | hidnplayr | 133 | invoke edit_box_key, URLbox |
5668 | hidnplayr | 134 | @@: |
5670 | hidnplayr | 135 | cmp [status], STATUS_REQ_LOGIN |
136 | jne .loop |
||
137 | cmp ah, 13 ; enter (return) key |
||
138 | je .login |
||
139 | invoke edit_box_key, USERbox |
||
140 | invoke edit_box_key, PASSbox |
||
141 | @@: |
||
5663 | hidnplayr | 142 | jmp .loop |
3545 | hidnplayr | 143 | |
5663 | hidnplayr | 144 | .btn: |
5668 | hidnplayr | 145 | mcall 17 ; get id |
3545 | hidnplayr | 146 | |
5668 | hidnplayr | 147 | cmp ah, 1 ; close ? |
5663 | hidnplayr | 148 | jz .close |
5668 | hidnplayr | 149 | cmp ah, 2 ; connect ? |
150 | je .connect |
||
151 | cmp ah, 3 ; login ? |
||
152 | je .login |
||
3545 | hidnplayr | 153 | |
5663 | hidnplayr | 154 | jmp .loop |
3545 | hidnplayr | 155 | |
5668 | hidnplayr | 156 | .connect: |
157 | mov eax, [URLbox.pos] |
||
158 | mov byte[serveraddr+eax], 0 |
||
159 | |||
5670 | hidnplayr | 160 | mov [status], STATUS_CONNECTING |
161 | inc [update_gui] |
||
162 | |||
5668 | hidnplayr | 163 | ; Create network thread |
164 | mcall 51, 1, thread_start, thread_stack |
||
165 | cmp eax, -1 |
||
166 | jne @f |
||
167 | mov [status], STATUS_THREAD_ERR |
||
5670 | hidnplayr | 168 | ; inc [update_gui] |
5668 | hidnplayr | 169 | @@: |
170 | jmp .loop |
||
171 | |||
172 | .login: |
||
5670 | hidnplayr | 173 | mov [status], STATUS_LOGIN |
174 | inc [update_gui] |
||
175 | jmp .loop |
||
5668 | hidnplayr | 176 | |
5663 | hidnplayr | 177 | .mouse: |
5668 | hidnplayr | 178 | cmp [status], STATUS_INITIAL |
179 | jne @f |
||
5663 | hidnplayr | 180 | invoke edit_box_mouse, URLbox |
5668 | hidnplayr | 181 | @@: |
5670 | hidnplayr | 182 | cmp [status], STATUS_REQ_LOGIN |
183 | jne @f |
||
184 | invoke edit_box_mouse, USERbox |
||
185 | invoke edit_box_mouse, PASSbox |
||
186 | @@: |
||
5663 | hidnplayr | 187 | jmp .loop |
3545 | hidnplayr | 188 | |
5663 | hidnplayr | 189 | .close: |
5680 | hidnplayr | 190 | mov [status], STATUS_CLOSED |
5668 | hidnplayr | 191 | mcall -1 |