Changeset 1f83244 in mainline
- Timestamp:
- 2006-06-16T20:00:29Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b34fab6
- Parents:
- d552ab9
- Location:
- console
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
console/console.c
rd552ab9 r1f83244 229 229 curs_visibility(0); 230 230 231 async_serialize_start(); 231 232 if (kernel_pixmap == -1) { 232 233 /* store/restore unsupported */ … … 238 239 kernel_pixmap = -1; 239 240 } 241 async_serialize_end(); 240 242 241 243 __SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE); … … 243 245 } 244 246 247 async_serialize_start(); 248 245 249 if (console_pixmap != -1) { 246 250 kernel_pixmap = switch_screens(console_pixmap); … … 281 285 curs_goto(conn->screenbuffer.position_y, conn->screenbuffer.position_x); 282 286 curs_visibility(conn->screenbuffer.is_cursor_visible); 287 288 async_serialize_end(); 283 289 } 284 290 … … 291 297 int c; 292 298 connection_t *conn; 299 int newcon; 293 300 294 301 /* Ignore parameters, the connection is alread opened */ … … 299 306 /* TODO: Handle hangup */ 300 307 return; 308 case KBD_MS_LEFT: 309 newcon = gcons_mouse_btn(IPC_GET_ARG1(call)); 310 if (newcon != -1) 311 change_console(newcon); 312 break; 301 313 case KBD_MS_MOVE: 302 314 gcons_mouse_move(IPC_GET_ARG1(call), IPC_GET_ARG2(call)); … … 312 324 // if ((c >= KBD_KEY_F1) && (c < KBD_KEY_F1 + CONSOLE_COUNT)) { 313 325 if ((c >= 0x101) && (c < 0x101 + CONSOLE_COUNT)) { 314 async_serialize_start();315 326 if (c == 0x112) 316 327 change_console(KERNEL_CONSOLE); 317 328 else 318 329 change_console(c - 0x101); 319 async_serialize_end();320 330 break; 321 331 } -
console/gcons.c
rd552ab9 r1f83244 241 241 } 242 242 243 int mouse_x, mouse_y; 244 int btn_pressed, btn_x, btn_y; 245 246 /** Handle mouse move 247 * 248 * @param dx Delta X of mouse move 249 * @param dy Delta Y of mouse move 250 */ 243 251 void gcons_mouse_move(int dx, int dy) 244 252 { 245 static int x = 0; 246 static int y = 0; 247 248 x = limit(x+dx, 0, xres); 249 y = limit(y+dy, 0, yres); 250 251 async_msg_2(fbphone, FB_POINTER_MOVE, x, y); 253 mouse_x = limit(mouse_x+dx, 0, xres); 254 mouse_y = limit(mouse_y+dy, 0, yres); 255 256 async_msg_2(fbphone, FB_POINTER_MOVE, mouse_x, mouse_y); 257 } 258 259 static int gcons_find_conbut(int x, int y) 260 { 261 int status_start = STATUS_START + (xres-800) / 2;; 262 263 if (y < STATUS_TOP || y >= STATUS_TOP+STATUS_HEIGHT) 264 return -1; 265 266 if (x < status_start) 267 return -1; 268 269 if (x >= status_start + (STATUS_WIDTH+STATUS_SPACE)*CONSOLE_COUNT) 270 return -1; 271 if (((x - status_start) % (STATUS_WIDTH+STATUS_SPACE)) >= STATUS_WIDTH) 272 return -1; 273 274 return (x-status_start) / (STATUS_WIDTH+STATUS_SPACE); 275 } 276 277 /** Handle mouse click 278 * 279 * @param state New state (1-pressed, 0-depressed) 280 */ 281 int gcons_mouse_btn(int state) 282 { 283 int conbut; 284 285 if (state) { 286 conbut = gcons_find_conbut(mouse_x, mouse_y); 287 if (conbut != -1) { 288 btn_pressed = 1; 289 btn_x = mouse_x; 290 btn_y = mouse_y; 291 } 292 return -1; 293 } 294 if (!state && !btn_pressed) 295 return -1; 296 btn_pressed = 0; 297 298 conbut = gcons_find_conbut(mouse_x, mouse_y); 299 if (conbut == gcons_find_conbut(btn_x, btn_y)) 300 return conbut; 301 return -1; 252 302 } 253 303 -
console/gcons.h
rd552ab9 r1f83244 43 43 void gcons_notify_disconnect(int consnum); 44 44 void gcons_mouse_move(int dx, int dy); 45 int gcons_mouse_btn(int state); 45 46 46 47 #endif
Note:
See TracChangeset
for help on using the changeset viewer.