1 /* -*- c-basic-offset: 8 -*- 2 rdesktop: A Remote Desktop Protocol client. 3 main ui header 4 Copyright (C) Jay Sorg 2005-2006 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2 of the License, or 9 (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License along 17 with this program; if not, write to the Free Software Foundation, Inc., 18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 */ 20 21 #pragma once 22 23 /* in uimain.c */ 24 int 25 ui_main(void); 26 void 27 ui_invalidate(int x, int y, int cx, int cy); 28 int 29 ui_read_wire(void); 30 void 31 ui_mouse_move(int x, int y); 32 void 33 ui_mouse_button(int button, int x, int y, int down); 34 void 35 ui_key_down(int key, int ext); 36 void 37 ui_key_up(int key, int ext); 38 39 void 40 41 ui_set_modifier_state(int code); 42 43 #define SPLIT_COLOUR15(c, r, g, b) \ 44 { \ 45 r = ((c >> 7) & 0xf8) | ((c >> 12) & 0x7); \ 46 g = ((c >> 2) & 0xf8) | ((c >> 8) & 0x7); \ 47 b = ((c << 3) & 0xf8) | ((c >> 2) & 0x7); \ 48 } 49 50 #define SPLIT_COLOUR16(c, r, g, b) \ 51 { \ 52 r = ((c >> 8) & 0xf8) | ((c >> 13) & 0x7); \ 53 g = ((c >> 3) & 0xfc) | ((c >> 9) & 0x3); \ 54 b = ((c << 3) & 0xf8) | ((c >> 2) & 0x7); \ 55 } 56 57 #define MAKE_COLOUR15(c, r, g, b) \ 58 { \ 59 c = ( \ 60 (((r & 0xff) >> 3) << 10) | \ 61 (((g & 0xff) >> 3) << 5) | \ 62 (((b & 0xff) >> 3) << 0) \ 63 ); \ 64 } 65 66 #define MAKE_COLOUR32(c, r, g, b) \ 67 { \ 68 c = ( \ 69 ((r & 0xff) << 16) | \ 70 ((g & 0xff) << 8) | \ 71 ((b & 0xff) << 0) \ 72 ); \ 73 } 74 75 #undef UI_MAX 76 #define UI_MAX(a, b) (((a) > (b)) ? (a) : (b)) 77 #undef UI_MIN 78 #define UI_MIN(a, b) (((a) < (b)) ? (a) : (b)) 79