ReactOS 0.4.15-dev-7897-g78dc504
svgawin.c File Reference
#include "../rdesktop.h"
#include <vga.h>
#include <vgakeyboard.h>
#include <vgamouse.h>
#include <vgagl.h>
#include <unistd.h>
#include <pwd.h>
#include <stdarg.h>
#include <sys/ioctl.h>
#include <linux/keyboard.h>
#include <linux/kd.h>
#include <fcntl.h>
Include dependency graph for svgawin.c:

Go to the source code of this file.

Classes

struct  tcursor
 
struct  bitmap
 
struct  myrect
 

Macros

#define DO_GLYPH(ttext, idx)
 

Functions

static void setled (int mask, int state)
 
int rop (int rop, int src, int dst)
 
int get_pixel (int x, int y)
 
void set_pixel (int x, int y, int pixel, int op)
 
int get_pixel2 (int x, int y, uint8 *data, int width, int bpp)
 
void set_pixel2 (int x, int y, int pixel, uint8 *data, int width, int bpp)
 
uint8get_ptr (int x, int y, uint8 *data, int width, int bpp)
 
BOOL is_pixel_on (uint8 *data, int x, int y, int width, int bpp)
 
void set_pixel_on (uint8 *data, int x, int y, int width, int bpp, int pixel)
 
int warp_coords (int *x, int *y, int *cx, int *cy, int *srcx, int *srcy)
 
void copy_mem (uint8 *d, uint8 *s, int n)
 
void copy_memb (uint8 *d, uint8 *s, int n)
 
void accel_draw_box (int x, int y, int cx, int cy, uint8 *data, int line_size)
 
void accel_fill_rect (int x, int y, int cx, int cy, int color)
 
void accel_screen_copy (int x, int y, int cx, int cy, int srcx, int srcy)
 
int contains_mouse (int x, int y, int cx, int cy)
 
void fill_rect (int x, int y, int cx, int cy, int colour, int opcode)
 
void get_rect (int x, int y, int cx, int cy, uint8 *p)
 
int is_contained_by (myrect *r1, myrect *r2)
 
void draw_cursor_under (int ox, int oy)
 
void draw_cursor (void)
 
void cache_rect (int x, int y, int cx, int cy, int do_warp)
 
void draw_cache_rects (void)
 
void key_event (int scancode, int pressed)
 
int ui_init (void)
 
void ui_deinit (void)
 
int ui_create_window (void)
 
void ui_destroy_window (void)
 
void process_mouse (void)
 
void process_keyboard (void)
 
BOOL ui_main_loop (void)
 
void ui_bell (void)
 
int ui_select (int in)
 
voidui_create_glyph (int width, int height, uint8 *data)
 
void ui_destroy_glyph (void *glyph)
 
void ui_destroy_bitmap (void *bmp)
 
void ui_reset_clip (void)
 
void ui_set_clip (int x, int y, int cx, int cy)
 
voidui_create_colourmap (COLOURMAP *colours)
 
void ui_destroy_colourmap (HCOLOURMAP map)
 
void ui_set_colourmap (void *map)
 
HBITMAP ui_create_bitmap (int width, int height, uint8 *data)
 
void draw_glyph (int x, int y, HGLYPH glyph, int fgcolour)
 
void ui_draw_text (uint8 font, uint8 flags, uint8 opcode, int mixmode, int x, int y, int clipx, int clipy, int clipcx, int clipcy, int boxx, int boxy, int boxcx, int boxcy, BRUSH *brush, int bgcolour, int fgcolour, uint8 *text, uint8 length)
 
void ui_line (uint8 opcode, int startx, int starty, int endx, int endy, PEN *pen)
 
void ui_triblt (uint8 opcode, int x, int y, int cx, int cy, HBITMAP src, int srcx, int srcy, BRUSH *brush, int bgcolour, int fgcolour)
 
void ui_memblt (uint8 opcode, int x, int y, int cx, int cy, HBITMAP src, int srcx, int srcy)
 
void ui_desktop_restore (uint32 offset, int x, int y, int cx, int cy)
 
void ui_desktop_save (uint32 offset, int x, int y, int cx, int cy)
 
void ui_rect (int x, int y, int cx, int cy, int colour)
 
void ui_screenblt (uint8 opcode, int x, int y, int cx, int cy, int srcx, int srcy)
 
void ui_patblt (uint8 opcode, int x, int y, int cx, int cy, BRUSH *brush, int bgcolour, int fgcolour)
 
void ui_destblt (uint8 opcode, int x, int y, int cx, int cy)
 
void ui_move_pointer (int x, int y)
 
void ui_set_null_cursor (void)
 
void ui_paint_bitmap (int x, int y, int cx, int cy, int width, int height, uint8 *data)
 
voidui_create_cursor (unsigned int x, unsigned int y, int width, int height, uint8 *andmask, uint8 *xormask)
 
void ui_destroy_cursor (void *cursor)
 
void ui_set_cursor (void *cursor)
 
uint16 ui_get_numlock_state (unsigned int state)
 
unsigned int read_keyboard_state (void)
 
void ui_resize_window (void)
 
void ui_begin_update (void)
 
void ui_end_update (void)
 
void ui_polygon (uint8 opcode, uint8 fillmode, POINT *point, int npoints, BRUSH *brush, int bgcolour, int fgcolour)
 
void ui_polyline (uint8 opcode, POINT *points, int npoints, PEN *pen)
 
void ui_ellipse (uint8 opcode, uint8 fillmode, int x, int y, int cx, int cy, BRUSH *brush, int bgcolour, int fgcolour)
 
void generate_random (uint8 *random)
 
void save_licence (uint8 *data, int length)
 
int load_licence (uint8 **data)
 
voidxrealloc (void *in_val, int size)
 
voidxmalloc (int size)
 
void xfree (void *in_val)
 
charxstrdup (const char *s)
 
void warning (char *format,...)
 
void unimpl (char *format,...)
 
void error (char *format,...)
 
BOOL rd_pstcache_mkdir (void)
 
int rd_open_file (char *filename)
 
void rd_close_file (int fd)
 
int rd_read_file (int fd, void *ptr, int len)
 
int rd_write_file (int fd, void *ptr, int len)
 
int rd_lseek_file (int fd, int offset)
 
BOOL rd_lock_file (int fd, int start, int len)
 
void get_username_and_hostname (void)
 
void out_params (void)
 
void hexdump (uint8 *p, uint32 len)
 
int parse_parameters (int in_argc, char **in_argv)
 
int main (int in_argc, char **in_argv)
 

Variables

int g_tcp_port_rdp
 
int g_use_rdp5 = 0
 
char g_hostname [16] = ""
 
char g_username [64] = ""
 
int g_height = 600
 
int g_width = 800
 
int g_server_bpp = 8
 
int g_encryption = 1
 
int g_desktop_save = 1
 
int g_polygon_ellipse_orders = 0
 
int g_bitmap_cache = 1
 
int g_bitmap_cache_persist_enable = False
 
int g_bitmap_cache_precache = True
 
int g_bitmap_compression = 1
 
int g_rdp5_performanceflags = 0
 
int g_console_session = 0
 
int g_keylayout = 0x409
 
int g_keyboard_type = 0x4
 
int g_keyboard_subtype = 0x0
 
int g_keyboard_functionkeys = 0xc
 
int g_argc = 0
 
char ** g_argv = 0
 
int UpAndRunning = 0
 
int g_sock = 0
 
int deactivated = 0
 
uint32 ext_disc_reason = 0
 
char g_servername [128] = ""
 
static uint32colmap = 0
 
static uint8desk_save = 0
 
static int g_server_Bpp = 1
 
static int numlock
 
static int capslock
 
static int scrolllock
 
static uint8sdata = 0
 
static int g_save_mem = 0
 
static int use_accel = 1
 
static int has_fill_box = 0
 
static int has_screen_copy = 0
 
static int has_put_image = 0
 
int clip_startx
 
int clip_starty
 
int clip_endx
 
int clip_endy
 
uint8 mouse_under [32 *32 *4]
 
int mousex = 0
 
int mousey = 0
 
int mouseb = 0
 
static tcursor mcursor
 
static int g_draw_mouse = 1
 
BOOL g_redirect = False
 
char g_redirect_server [64]
 
char g_redirect_domain [16]
 
char g_redirect_password [64]
 
char g_redirect_username [64]
 
char g_redirect_cookie [128]
 
uint32 g_redirect_flags = 0
 
myrecthead_rect = 0
 

Macro Definition Documentation

◆ DO_GLYPH

#define DO_GLYPH (   ttext,
  idx 
)
Value:
{\
glyph = cache_get_font (font, ttext[idx]);\
{\
xyoffset = ttext[++idx];\
if ((xyoffset & 0x80))\
{\
y += ttext[idx+1] | (ttext[idx+2] << 8);\
else\
x += ttext[idx+1] | (ttext[idx+2] << 8);\
idx += 2;\
}\
else\
{\
y += xyoffset;\
else\
x += xyoffset;\
}\
}\
if (glyph != NULL)\
{\
draw_glyph (x + glyph->offset, y + glyph->baseline, glyph->pixmap, fgcolour);\
x += glyph->width;\
}\
}
FONTGLYPH * cache_get_font(uint8 font, uint16 character)
Definition: cache.c:279
#define TEXT2_IMPLICIT_X
Definition: constants.h:276
#define TEXT2_VERTICAL
Definition: constants.h:275
#define NULL
Definition: types.h:112
unsigned int idx
Definition: utils.c:41
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLbitfield flags
Definition: glext.h:7161
Definition: mk_font.cpp:20

Definition at line 1174 of file svgawin.c.

Function Documentation

◆ accel_draw_box()

void accel_draw_box ( int  x,
int  y,
int  cx,
int  cy,
uint8 data,
int  line_size 
)

Definition at line 402 of file svgawin.c.

403{
404 int i;
405 uint8* s;
406 uint8* d;
407
408 if (sdata != 0)
409 {
410 s = data;
412 for (i = 0; i < cy; i++)
413 {
415 s = s + line_size;
416 d = d + g_width * g_server_Bpp;
417 }
418 }
419 else if (has_put_image && line_size == cx * g_server_Bpp)
420 {
421 vga_accel(ACCEL_PUTIMAGE, x, y, cx, cy, data);
422 }
423 else
424 {
425 s = data;
426 for (i = 0; i < cy; i++)
427 {
428 vga_drawscansegment(s, x, y + i, cx * g_server_Bpp);
429 s = s + line_size;
430 }
431 }
432}
unsigned char uint8
Definition: types.h:28
GLdouble s
Definition: gl.h:2039
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define d
Definition: ke_i.h:81
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
int g_width
Definition: svgawin.c:42
int g_server_bpp
Definition: svgawin.c:43
void copy_mem(uint8 *d, uint8 *s, int n)
Definition: svgawin.c:355
static int has_put_image
Definition: svgawin.c:84
uint8 * get_ptr(int x, int y, uint8 *data, int width, int bpp)
Definition: svgawin.c:269
static uint8 * sdata
Definition: svgawin.c:77
static int g_server_Bpp
Definition: svgawin.c:68

Referenced by ui_memblt(), and ui_paint_bitmap().

◆ accel_fill_rect()

void accel_fill_rect ( int  x,
int  y,
int  cx,
int  cy,
int  color 
)

Definition at line 435 of file svgawin.c.

436{
437 int i;
438 uint8* temp;
439 uint8* d;
440
441 if (sdata != 0)
442 {
444 if (g_server_Bpp == 1)
445 for (i = 0; i < cx; i++)
446 temp[i] = color;
447 else if (g_server_Bpp == 2)
448 for (i = 0; i < cx; i++)
449 ((uint16*)temp)[i] = color;
451 for (i = 0; i < cy; i++)
452 {
454 d = d + g_width * g_server_Bpp;
455 }
456 xfree(temp);
457 }
458 else if (has_fill_box)
459 {
460 vga_accel(ACCEL_SETFGCOLOR, color);
461 vga_accel(ACCEL_FILLBOX, x, y, cx, cy);
462 }
463 else
464 {
466 if (g_server_Bpp == 1)
467 for (i = 0; i < cx; i++)
468 temp[i] = color;
469 else if (g_server_Bpp == 2)
470 for (i = 0; i < cx; i++)
471 ((uint16*)temp)[i] = color;
472 for (i = 0; i < cy; i++)
473 vga_drawscansegment(temp, x, y + i, cx * g_server_Bpp);
474 xfree(temp);
475 }
476}
unsigned short uint16
Definition: types.h:30
GLuint color
Definition: glext.h:6243
static calc_node_t temp
Definition: rpn_ieee.c:38
void xfree(void *in_val)
Definition: svgawin.c:1696
void * xmalloc(int size)
Definition: svgawin.c:1690
static int has_fill_box
Definition: svgawin.c:82

Referenced by fill_rect(), and ui_rect().

◆ accel_screen_copy()

void accel_screen_copy ( int  x,
int  y,
int  cx,
int  cy,
int  srcx,
int  srcy 
)

Definition at line 479 of file svgawin.c.

480{
481 uint8* temp;
482 uint8* s;
483 uint8* d;
484 int i;
485
486 if (sdata != 0)
487 {
488 if (srcy < y)
489 { // bottom to top
490 s = get_ptr(srcx, (srcy + cy) - 1, sdata, g_width, g_server_bpp);
491 d = get_ptr(x, (y + cy) - 1, sdata, g_width, g_server_bpp);
492 for (i = 0; i < cy; i++) // copy down
493 {
495 s = s - g_width * g_server_Bpp;
496 d = d - g_width * g_server_Bpp;
497 }
498 }
499 else if (srcy > y || srcx > x) // copy up or left
500 { // top to bottom
501 s = get_ptr(srcx, srcy, sdata, g_width, g_server_bpp);
503 for (i = 0; i < cy; i++)
504 {
506 s = s + g_width * g_server_Bpp;
507 d = d + g_width * g_server_Bpp;
508 }
509 }
510 else // copy straight right
511 {
512 s = get_ptr(srcx, srcy, sdata, g_width, g_server_bpp);
514 for (i = 0; i < cy; i++)
515 {
517 s = s + g_width * g_server_Bpp;
518 d = d + g_width * g_server_Bpp;
519 }
520 }
521 }
522 else if (has_screen_copy)
523 {
524 vga_accel(ACCEL_SCREENCOPY, srcx, srcy, x, y, cx, cy);
525 }
526 else
527 {
528 // slow
530 for (i = 0; i < cy; i++)
531 vga_getscansegment(get_ptr(0, i, temp, cx, g_server_bpp), srcx, srcy + i, cx * g_server_Bpp);
532 for (i = 0; i < cy; i++)
533 vga_drawscansegment(get_ptr(0, i, temp, cx, g_server_bpp), x, y + i, cx * g_server_Bpp);
534 xfree(temp);
535 }
536}
static int has_screen_copy
Definition: svgawin.c:83
void copy_memb(uint8 *d, uint8 *s, int n)
Definition: svgawin.c:377

Referenced by ui_screenblt().

◆ cache_rect()

void cache_rect ( int  x,
int  y,
int  cx,
int  cy,
int  do_warp 
)

Definition at line 704 of file svgawin.c.

705{
706 myrect* rect;
707 myrect* walk_rect;
708
709 if (sdata == 0)
710 {
711 draw_cursor();
712 return;
713 }
714 if (do_warp)
715 if (!warp_coords(&x, &y, &cx, &cy, NULL, NULL))
716 return;
717 rect = (myrect*)xmalloc(sizeof(myrect));
718 rect->x = x;
719 rect->y = y;
720 rect->cx = cx;
721 rect->cy = cy;
722 rect->next = 0;
723 rect->prev = 0;
724 if (head_rect == 0)
725 head_rect = rect;
726 else
727 {
728 walk_rect = 0;
729 do
730 {
731 if (walk_rect == 0)
732 walk_rect = head_rect;
733 else
734 walk_rect = walk_rect->next;
735 if (is_contained_by(rect, walk_rect))
736 {
737 xfree(rect);
738 return;
739 }
740 }
741 while (walk_rect->next != 0);
742 walk_rect->next = rect;
743 rect->prev = walk_rect;
744 }
745}
& rect
Definition: startmenu.cpp:1413
void * next
Definition: svgawin.c:139
int warp_coords(int *x, int *y, int *cx, int *cy, int *srcx, int *srcy)
Definition: svgawin.c:317
myrect * head_rect
Definition: svgawin.c:142
void draw_cursor(void)
Definition: svgawin.c:650
int is_contained_by(myrect *r1, myrect *r2)
Definition: svgawin.c:609

Referenced by ui_destblt(), ui_draw_text(), ui_line(), ui_memblt(), ui_paint_bitmap(), ui_patblt(), ui_rect(), and ui_screenblt().

◆ contains_mouse()

int contains_mouse ( int  x,
int  y,
int  cx,
int  cy 
)

Definition at line 540 of file svgawin.c.

541{
542 if (mousex + 32 >= x &&
543 mousey + 32 >= y &&
544 mousex <= x + cx &&
545 mousey <= y + cy)
546 return 1;
547 else
548 return 0;
549}
int mousey
Definition: svgawin.c:95
int mousex
Definition: svgawin.c:94

Referenced by ui_desktop_save(), ui_destblt(), ui_draw_text(), ui_line(), ui_memblt(), ui_paint_bitmap(), ui_patblt(), ui_rect(), and ui_screenblt().

◆ copy_mem()

void copy_mem ( uint8 d,
uint8 s,
int  n 
)

Definition at line 355 of file svgawin.c.

356{
357 while (n & (~7))
358 {
359 *(d++) = *(s++);
360 *(d++) = *(s++);
361 *(d++) = *(s++);
362 *(d++) = *(s++);
363 *(d++) = *(s++);
364 *(d++) = *(s++);
365 *(d++) = *(s++);
366 *(d++) = *(s++);
367 n = n - 8;
368 }
369 while (n > 0)
370 {
371 *(d++) = *(s++);
372 n--;
373 }
374}
GLdouble n
Definition: glext.h:7729

Referenced by accel_draw_box(), accel_fill_rect(), accel_screen_copy(), get_rect(), and ui_create_bitmap().

◆ copy_memb()

void copy_memb ( uint8 d,
uint8 s,
int  n 
)

Definition at line 377 of file svgawin.c.

378{
379 d = (d + n) - 1;
380 s = (s + n) - 1;
381 while (n & (~7))
382 {
383 *(d--) = *(s--);
384 *(d--) = *(s--);
385 *(d--) = *(s--);
386 *(d--) = *(s--);
387 *(d--) = *(s--);
388 *(d--) = *(s--);
389 *(d--) = *(s--);
390 *(d--) = *(s--);
391 n = n - 8;
392 }
393 while (n > 0)
394 {
395 *(d--) = *(s--);
396 n--;
397 }
398}

Referenced by accel_screen_copy().

◆ draw_cache_rects()

void draw_cache_rects ( void  )

Definition at line 748 of file svgawin.c.

749{
750 int i;
751 myrect* rect;
752 myrect* rect1;
753 uint8* p;
754
755 // draw all the rects
756 rect = head_rect;
757 while (rect != 0)
758 {
760 for (i = 0; i < rect->cy; i++)
761 {
762 vga_drawscansegment(p, rect->x, rect->y + i, rect->cx * g_server_Bpp);
763 p = p + g_width * g_server_Bpp;
764 }
765 rect1 = rect;
766 rect = rect->next;
767 xfree(rect1);
768 }
769 head_rect = 0;
770}
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by ui_end_update(), and ui_screenblt().

◆ draw_cursor()

void draw_cursor ( void  )

Definition at line 650 of file svgawin.c.

651{
652 int i;
653 int j;
654 int k;
655 int pixel;
656 uint8 mouse_a[32 * 32 * 4];
657 uint8* ptr;
658 int len;
659
660 if (!g_draw_mouse)
661 return;
662 memset(mouse_under, 0, sizeof(mouse_under));
663 for (i = 0; i < 32; i++)
664 {
665 for (j = 0; j < 32; j++)
666 {
667 pixel = get_pixel(mousex + j, mousey + i);
668 set_pixel2(j, i, pixel, mouse_under, 32, g_server_bpp);
669 if (mcursor.andmask[i * 32 + j] == 0)
670 k = 0;
671 else
672 k = ~0;
673 pixel = rop(0x8, k, pixel);
674 if (mcursor.xormask[i * 32 + j] == 0)
675 k = 0;
676 else
677 k = ~0;
678 pixel = rop(0x6, k, pixel);
679 set_pixel2(j, i, pixel, mouse_a, 32, g_server_bpp);
680 }
681 }
682 if (mousex < 0)
683 k = -mousex;
684 else
685 k = 0;
686 j = g_width - mousex;
687 if (j > 32)
688 j = 32;
689 if (j > 0)
690 {
691 for (i = mousey; i < mousey + 32; i++)
692 if (i < g_height && i >= 0)
693 {
694 ptr = get_ptr(k, i - mousey, mouse_a, 32, g_server_bpp);
695 len = (j - k) * g_server_Bpp;
696 vga_drawscansegment(ptr, mousex + k, i, len);
697 }
698 }
699 g_draw_mouse = 0;
700}
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
static PVOID ptr
Definition: dispmode.c:27
int k
Definition: mpi.c:3369
#define memset(x, y, z)
Definition: compat.h:39
uint8 andmask[32 *32]
Definition: svgawin.c:101
uint8 xormask[32 *32]
Definition: svgawin.c:102
void set_pixel2(int x, int y, int pixel, uint8 *data, int width, int bpp)
Definition: svgawin.c:259
static tcursor mcursor
Definition: svgawin.c:110
static int g_draw_mouse
Definition: svgawin.c:112
int get_pixel(int x, int y)
Definition: svgawin.c:195
uint8 mouse_under[32 *32 *4]
Definition: svgawin.c:93
int rop(int rop, int src, int dst)
Definition: svgawin.c:169

Referenced by cache_rect(), process_mouse(), ui_end_update(), ui_set_cursor(), and ui_set_null_cursor().

◆ draw_cursor_under()

void draw_cursor_under ( int  ox,
int  oy 
)

Definition at line 621 of file svgawin.c.

622{
623 int i;
624 int j;
625 int k;
626 uint8* ptr;
627 int len;
628
629 if (ox < 0)
630 k = -ox;
631 else
632 k = 0;
633 j = g_width - ox;
634 if (j > 32)
635 j = 32;
636 if (j > 0)
637 {
638 for (i = 0; i < 32; i++)
639 {
641 len = (j - k) * g_server_Bpp;
642 if (ox + k >= 0 && oy + i >= 0 && ox + k < g_width && oy + i < g_height)
643 vga_drawscansegment(ptr, ox + k, oy + i, len);
644 }
645 }
646 g_draw_mouse = 1;
647}
int g_height
Definition: svgawin.c:41

Referenced by process_mouse(), ui_desktop_save(), ui_destblt(), ui_draw_text(), ui_line(), ui_memblt(), ui_paint_bitmap(), ui_patblt(), ui_rect(), ui_screenblt(), ui_set_cursor(), and ui_set_null_cursor().

◆ draw_glyph()

void draw_glyph ( int  x,
int  y,
HGLYPH  glyph,
int  fgcolour 
)

Definition at line 1160 of file svgawin.c.

1161{
1162 bitmap* the_glyph;
1163 int i, j;
1164
1165 the_glyph = (bitmap*)glyph;
1166 if (the_glyph == NULL)
1167 return;
1168 for (i = 0; i < the_glyph->height; i++)
1169 for (j = 0; j < the_glyph->width; j++)
1170 if (is_pixel_on(the_glyph->data, j, i, the_glyph->width, 8))
1171 set_pixel(x + j, y + i, fgcolour, 0xc);
1172}
Definition: uimain.c:89
uint8 * data
Definition: uimain.c:90
uint32 width
Definition: uimain.c:91
uint32 height
Definition: uimain.c:92
void set_pixel(int x, int y, int pixel, int op)
Definition: svgawin.c:217
BOOL is_pixel_on(uint8 *data, int x, int y, int width, int bpp)
Definition: svgawin.c:281

◆ error()

void error ( char format,
  ... 
)

Definition at line 1736 of file svgawin.c.

1737{
1738 va_list ap;
1739
1740 fprintf(stderr, "ERROR: ");
1741 va_start(ap, format);
1743 va_end(ap);
1744}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_opt_ _CRTIMP int __cdecl vfprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36

◆ fill_rect()

void fill_rect ( int  x,
int  y,
int  cx,
int  cy,
int  colour,
int  opcode 
)

Definition at line 552 of file svgawin.c.

553{
554 int i;
555 int j;
556
557 if (warp_coords(&x, &y, &cx, &cy, NULL, NULL))
558 {
559 if (opcode == 0xc)
560 accel_fill_rect(x, y, cx, cy, colour);
561 else if (opcode == 0xf)
562 accel_fill_rect(x, y, cx, cy, -1);
563 else if (opcode == 0x0)
564 accel_fill_rect(x, y, cx, cy, 0);
565 else
566 {
567 for (i = 0; i < cy; i++)
568 for (j = 0; j < cx; j++)
569 set_pixel(x + j, y + i, colour, opcode);
570 }
571 }
572}
void accel_fill_rect(int x, int y, int cx, int cy, int color)
Definition: svgawin.c:435

Referenced by ui_destblt(), ui_draw_text(), and ui_patblt().

◆ generate_random()

void generate_random ( uint8 random)

Definition at line 1667 of file svgawin.c.

1668{
1669 memcpy(random, "12345678901234567890123456789012", 32);
1670}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define random
Definition: rosdhcp.h:81

◆ get_pixel()

int get_pixel ( int  x,
int  y 
)

Definition at line 195 of file svgawin.c.

196{
197 if (x >= 0 && x < g_width && y >= 0 && y < g_height)
198 {
199 if (sdata != 0)
200 {
201 if (g_server_Bpp == 1)
202 return sdata[y * g_width + x];
203 else if (g_server_Bpp == 2)
204 return ((uint16*)sdata)[y * g_width + x];
205 else
206 return 0;
207 }
208 else
209 return vga_getpixel(x, y);
210 }
211 else
212 return 0;
213}

Referenced by draw_cursor(), set_pixel(), and ui_screenblt().

◆ get_pixel2()

int get_pixel2 ( int  x,
int  y,
uint8 data,
int  width,
int  bpp 
)

Definition at line 247 of file svgawin.c.

248{
249 if (bpp == 8)
250 return data[y * width + x];
251 else if (bpp == 16)
252 return ((uint16*)data)[y * width + x];
253 else
254 return 0;
255}
DWORD bpp
Definition: surface.c:185
GLint GLint GLsizei width
Definition: gl.h:1546

Referenced by ui_memblt(), and ui_screenblt().

◆ get_ptr()

uint8 * get_ptr ( int  x,
int  y,
uint8 data,
int  width,
int  bpp 
)

Definition at line 269 of file svgawin.c.

270{
271 if (bpp == 8)
272 return data + (y * width + x);
273 else if (bpp == 16)
274 return data + (y * width + x) * 2;
275 else
276 return 0;
277}

Referenced by accel_draw_box(), accel_fill_rect(), accel_screen_copy(), draw_cache_rects(), draw_cursor(), draw_cursor_under(), get_rect(), and ui_memblt().

◆ get_rect()

void get_rect ( int  x,
int  y,
int  cx,
int  cy,
uint8 p 
)

Definition at line 575 of file svgawin.c.

576{
577 int i;
578
579 if (x < 0)
580 {
581 cx = cx + x;
582 x = 0;
583 }
584 if (y < 0)
585 {
586 cy = cy + y;
587 y = 0;
588 }
589 if (sdata != 0)
590 {
591 for (i = 0; i < cy; i++)
592 {
594 p = p + cx * g_server_Bpp;
595 }
596 }
597 else
598 {
599 for (i = 0; i < cy; i++)
600 {
601 vga_getscansegment(p, x, y + i, cx * g_server_Bpp);
602 p = p + cx * g_server_Bpp;
603 }
604 }
605}

Referenced by ui_desktop_save().

◆ get_username_and_hostname()

void get_username_and_hostname ( void  )

Definition at line 1788 of file svgawin.c.

1789{
1790 char fullhostname[64];
1791 char* p;
1792 struct passwd* pw;
1793
1794 STRNCPY(g_username, "unknown", sizeof(g_username));
1795 STRNCPY(g_hostname, "unknown", sizeof(g_hostname));
1796 pw = getpwuid(getuid());
1797 if (pw != NULL && pw->pw_name != NULL)
1798 {
1799 STRNCPY(g_username, pw->pw_name, sizeof(g_username));
1800 }
1801 if (gethostname(fullhostname, sizeof(fullhostname)) != -1)
1802 {
1803 p = strchr(fullhostname, '.');
1804 if (p != NULL)
1805 *p = 0;
1806 STRNCPY(g_hostname, fullhostname, sizeof(g_hostname));
1807 }
1808}
char * strchr(const char *String, int ch)
Definition: utclib.c:501
#define STRNCPY(dst, src, n)
Definition: rdesktop.h:168
uid_t getuid()
Definition: uid.c:27
INT WSAAPI gethostname(OUT char FAR *name, IN INT namelen)
Definition: getxbyxx.c:397
char g_hostname[16]
Definition: svgawin.c:39
char g_username[64]
Definition: svgawin.c:40

Referenced by main().

◆ hexdump()

void hexdump ( uint8 p,
uint32  len 
)

Definition at line 1830 of file svgawin.c.

1831{
1832 uint8* line;
1833 int i;
1834 int thisline;
1835 int offset;
1836
1837 line = p;
1838 offset = 0;
1839 while (offset < len)
1840 {
1841 printf("%04x ", offset);
1842 thisline = len - offset;
1843 if (thisline > 16)
1844 thisline = 16;
1845
1846 for (i = 0; i < thisline; i++)
1847 printf("%02x ", line[i]);
1848
1849 for (; i < 16; i++)
1850 printf(" ");
1851
1852 for (i = 0; i < thisline; i++)
1853 printf("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.');
1854
1855 printf("\n");
1856 offset += thisline;
1857 line += thisline;
1858 }
1859}
#define printf
Definition: freeldr.h:93
GLintptr offset
Definition: glext.h:5920
Definition: parser.c:49

◆ is_contained_by()

int is_contained_by ( myrect r1,
myrect r2 
)

Definition at line 609 of file svgawin.c.

610{
611 if (r1->x >= r2->x &&
612 r1->y >= r2->y &&
613 r1->x + r1->cx <= r2->x + r2->cx &&
614 r1->y + r1->cy <= r2->y + r2->cy)
615 return 1;
616 else
617 return 0;
618}
static DNS_RECORDW r1
Definition: record.c:37
static DNS_RECORDW r2
Definition: record.c:38

Referenced by cache_rect().

◆ is_pixel_on()

BOOL is_pixel_on ( uint8 data,
int  x,
int  y,
int  width,
int  bpp 
)

Definition at line 281 of file svgawin.c.

282{
283 int start;
284 int shift;
285
286 if (bpp == 1)
287 {
288 width = (width + 7) / 8;
289 start = (y * width) + x / 8;
290 shift = x % 8;
291 return (data[start] & (0x80 >> shift)) != 0;
292 }
293 else if (bpp == 8)
294 {
295 return data[y * width + x] != 0;
296 }
297 else if (bpp == 24)
298 {
299 return data[(y * 3) * width + (x * 3)] != 0 &&
300 data[(y * 3) * width + (x * 3) + 1] != 0 &&
301 data[(y * 3) * width + (x * 3) + 2] != 0;
302 }
303 else
304 return False;
305}
#define False
Definition: types.h:25
GLuint start
Definition: gl.h:1545
#define shift
Definition: input.c:1755

Referenced by draw_glyph(), ui_create_cursor(), ui_create_glyph(), and ui_patblt().

◆ key_event()

void key_event ( int  scancode,
int  pressed 
)

Definition at line 773 of file svgawin.c.

774{
775 int rdpkey;
776 int ext;
777
778 if (!UpAndRunning)
779 return;
780 rdpkey = scancode;
781 ext = 0;
782
783 // Keyboard LEDS
784 if ((scancode == SCANCODE_CAPSLOCK) && pressed)
785 {
787 setled(LED_CAP, capslock);
788 }
789 if ((scancode == SCANCODE_SCROLLLOCK) && pressed)
790 {
792 setled(LED_SCR, scrolllock);
793 }
794
795 if ((scancode == SCANCODE_NUMLOCK) && pressed)
796 {
797 numlock = !numlock;
798 setled(LED_NUM, numlock);
799 }
800
801 switch (scancode)
802 {
803 case SCANCODE_CURSORBLOCKUP: rdpkey = 0xc8; ext = KBD_FLAG_EXT; break; // up arrow
804 case SCANCODE_CURSORBLOCKDOWN: rdpkey = 0xd0; ext = KBD_FLAG_EXT; break; // down arrow
805 case SCANCODE_CURSORBLOCKRIGHT: rdpkey = 0xcd; ext = KBD_FLAG_EXT; break; // right arrow
806 case SCANCODE_CURSORBLOCKLEFT: rdpkey = 0xcb; ext = KBD_FLAG_EXT; break; // left arrow
807 case SCANCODE_PAGEDOWN: rdpkey = 0xd1; ext = KBD_FLAG_EXT; break; // page down
808 case SCANCODE_PAGEUP: rdpkey = 0xc9; ext = KBD_FLAG_EXT; break; // page up
809 case SCANCODE_HOME: rdpkey = 0xc7; ext = KBD_FLAG_EXT; break; // home
810 case SCANCODE_END: rdpkey = 0xcf; ext = KBD_FLAG_EXT; break; // end
811 case SCANCODE_INSERT: rdpkey = 0xd2; ext = KBD_FLAG_EXT; break; // insert
812 case SCANCODE_REMOVE: rdpkey = 0xd3; ext = KBD_FLAG_EXT; break; // delete
813 case SCANCODE_KEYPADDIVIDE: rdpkey = 0x35; break; // /
814 case SCANCODE_KEYPADENTER: rdpkey = 0x1c; break; // enter
815 case SCANCODE_RIGHTCONTROL: rdpkey = 0x1d; break; // right ctrl
816 case SCANCODE_RIGHTALT: rdpkey = 0x38; break; // right alt
817 case SCANCODE_LEFTWIN: rdpkey = 0x5b; ext = KBD_FLAG_EXT; break; // left win
818 case SCANCODE_RIGHTWIN: rdpkey = 0x5c; ext = KBD_FLAG_EXT; break; // right win
819 case 127: rdpkey = 0x5d; ext = KBD_FLAG_EXT; break; // menu key
820 case SCANCODE_PRINTSCREEN: rdpkey = 0x37; ext = KBD_FLAG_EXT; break; // print screen
821 case SCANCODE_BREAK: //rdpkey = 0; break; // break
822 {
823 if (pressed)
824 {
828 }
829 rdpkey = 0;
830 }
831 case SCANCODE_SCROLLLOCK: rdpkey = 0x46; break; // scroll lock
832 case 112: // mouse down
833 {
835 mouse_getx(), mouse_gety());
836 return;
837 }
838 case 113: // mouse up
839 {
841 mouse_getx(), mouse_gety());
842 return;
843 }
844 }
845// printf("%d %d\n", scancode, pressed);
846 if (pressed)
848 else
850
851
852}
#define RDP_KEYPRESS
Definition: constants.h:251
#define MOUSE_FLAG_BUTTON5
Definition: constants.h:259
#define MOUSE_FLAG_DOWN
Definition: constants.h:260
#define RDP_KEYRELEASE
Definition: constants.h:252
#define MOUSE_FLAG_BUTTON4
Definition: constants.h:258
@ RDP_INPUT_SCANCODE
Definition: constants.h:234
@ RDP_INPUT_MOUSE
Definition: constants.h:235
#define KBD_FLAG_EXT
Definition: constants.h:240
void rdp_send_input(uint32 time, uint16 message_type, uint16 device_flags, uint16 param1, uint16 param2)
Definition: rdp.c:551
static const WCHAR *const ext[]
Definition: module.c:53
static int capslock
Definition: svgawin.c:72
int UpAndRunning
Definition: svgawin.c:61
static void setled(int mask, int state)
Definition: svgawin.c:146
static int numlock
Definition: svgawin.c:71
static int scrolllock
Definition: svgawin.c:73

Referenced by handle_edit_event(), HTMLElement_handle_event(), HTMLEventObj_get_altKey(), HTMLEventObj_get_ctrlKey(), HTMLEventObj_get_keyCode(), HTMLEventObj_get_shiftKey(), test_WriteConsoleInputA(), test_WriteConsoleInputW(), and ui_create_window().

◆ load_licence()

int load_licence ( uint8 **  data)

Definition at line 1678 of file svgawin.c.

1679{
1680 return 0;
1681}

◆ main()

int main ( int  in_argc,
char **  in_argv 
)

Definition at line 1934 of file svgawin.c.

1935{
1937 if (!parse_parameters(in_argc, in_argv))
1938 return 0;
1939 if (!ui_init())
1940 return 1;
1941 if (!ui_create_window())
1942 return 1;
1943 ui_main_loop();
1945 ui_deinit();
1946 return 0;
1947}
int parse_parameters(int in_argc, char **in_argv)
Definition: svgawin.c:1862
int ui_create_window(void)
Definition: svgawin.c:870
void ui_destroy_window(void)
Definition: svgawin.c:934
BOOL ui_main_loop(void)
Definition: svgawin.c:1002
int ui_init(void)
Definition: svgawin.c:855
void ui_deinit(void)
Definition: svgawin.c:864
void get_username_and_hostname(void)
Definition: svgawin.c:1788

◆ out_params()

void out_params ( void  )

Definition at line 1811 of file svgawin.c.

1812{
1813 fprintf(stderr, "rdesktop: A Remote Desktop Protocol client.\n");
1814 fprintf(stderr, "Version " VERSION ". Copyright (C) 1999-2003 Matt Chapman.\n");
1815 fprintf(stderr, "See http://www.rdesktop.org/ for more information.\n\n");
1816 fprintf(stderr, "Usage: svgardesktop [options] server\n");
1817 fprintf(stderr, " -g: desktop geometry (WxH)\n");
1818 fprintf(stderr, " -4: use RDP version 4\n");
1819 fprintf(stderr, " -5: use RDP version 5 (default)\n");
1820 fprintf(stderr, " -t: tcp port\n");
1821 fprintf(stderr, " -u: user name\n");
1822 fprintf(stderr, " -n: client hostname\n");
1823 fprintf(stderr, " -d: disable accel funcs\n");
1824 fprintf(stderr, " -a: connection colour depth\n");
1825 fprintf(stderr, " -l: low memory\n");
1826 fprintf(stderr, "\n");
1827}
#define VERSION
Definition: rdesktop.h:45

Referenced by parse_parameters().

◆ parse_parameters()

int parse_parameters ( int  in_argc,
char **  in_argv 
)

Definition at line 1862 of file svgawin.c.

1863{
1864 int i;
1865 char* p;
1866
1867 if (in_argc <= 1)
1868 {
1869 out_params();
1870 return 0;
1871 }
1872 g_argc = in_argc;
1873 g_argv = in_argv;
1874 for (i = 1; i < in_argc; i++)
1875 {
1876 strcpy(g_servername, in_argv[i]);
1877 if (strcmp(in_argv[i], "-g") == 0)
1878 {
1879 g_width = strtol(in_argv[i + 1], &p, 10);
1880 if (g_width <= 0)
1881 {
1882 error("invalid geometry\n");
1883 return 0;
1884 }
1885 if (*p == 'x')
1886 g_height = strtol(p + 1, NULL, 10);
1887 if (g_height <= 0)
1888 {
1889 error("invalid geometry\n");
1890 return 0;
1891 }
1892 g_width = (g_width + 3) & ~3;
1893 }
1894 else if (strcmp(in_argv[i], "-4") == 0)
1895 g_use_rdp5 = 0;
1896 else if (strcmp(in_argv[i], "-5") == 0)
1897 g_use_rdp5 = 1;
1898 else if (strcmp(in_argv[i], "-t") == 0)
1899 g_tcp_port_rdp = strtol(in_argv[i + 1], &p, 10);
1900 else if (strcmp(in_argv[i], "-h") == 0)
1901 {
1902 out_params();
1903 return 0;
1904 }
1905 else if (strcmp(in_argv[i], "-n") == 0)
1906 {
1907 STRNCPY(g_hostname, in_argv[i + 1], sizeof(g_hostname));
1908 }
1909 else if (strcmp(in_argv[i], "-u") == 0)
1910 {
1911 STRNCPY(g_username, in_argv[i + 1], sizeof(g_username));
1912 }
1913 else if (strcmp(in_argv[i], "-d") == 0)
1914 {
1915 use_accel = 0;
1916 }
1917 else if (strcmp(in_argv[i], "-a") == 0)
1918 {
1919 g_server_bpp = strtol(in_argv[i + 1], NULL, 10);
1920 if (g_server_bpp != 8 && g_server_bpp != 16)
1921 {
1922 error("invalid server bpp\n");
1923 return 0;
1924 }
1925 g_server_Bpp = (g_server_bpp + 7) / 8;
1926 }
1927 else if (strcmp(in_argv[i], "-l") == 0)
1928 g_save_mem = 1;
1929 }
1930 return 1;
1931}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
_Check_return_ long __cdecl strtol(_In_z_ const char *_Str, _Out_opt_ _Deref_post_z_ char **_EndPtr, _In_ int _Radix)
#define error(str)
Definition: mkdosfs.c:1605
int g_tcp_port_rdp
Definition: tcp.c:75
char ** g_argv
Definition: svgawin.c:60
int g_use_rdp5
Definition: svgawin.c:38
static int g_save_mem
Definition: svgawin.c:78
int g_argc
Definition: svgawin.c:59
char g_servername[128]
Definition: svgawin.c:65
void out_params(void)
Definition: svgawin.c:1811
static int use_accel
Definition: svgawin.c:81

Referenced by main().

◆ process_keyboard()

void process_keyboard ( void  )

Definition at line 995 of file svgawin.c.

996{
997 if (!UpAndRunning)
998 return;
999}

Referenced by ui_main_loop().

◆ process_mouse()

void process_mouse ( void  )

Definition at line 943 of file svgawin.c.

944{
945 int ox = mousex;
946 int oy = mousey;
947 int ob = mouseb;
948
949 if (!UpAndRunning)
950 return;
951 mousex = mouse_getx() - mcursor.x;
952 mousey = mouse_gety() - mcursor.y;
953 mouseb = mouse_getbutton();
954
955 if (mouseb != ob) // button
956 {
957 // right button
958 if (mouseb & 1)
959 if (!(ob & 1))
962 if (ob & 1)
963 if (!(mouseb & 1))
966 // middle button
967 if (mouseb & 2)
968 if (!(ob & 2))
971 if (ob & 2)
972 if (!(mouseb & 2))
975 // left button
976 if (mouseb & 4)
977 if (!(ob & 4))
980 if (ob & 4)
981 if (!(mouseb & 4))
984 }
985 if (mousex != ox || mousey != oy) // movement
986 {
989 draw_cursor_under(ox, oy);
990 draw_cursor();
991 }
992}
#define MOUSE_FLAG_BUTTON1
Definition: constants.h:255
#define MOUSE_FLAG_BUTTON2
Definition: constants.h:256
#define MOUSE_FLAG_BUTTON3
Definition: constants.h:257
#define MOUSE_FLAG_MOVE
Definition: constants.h:254
int x
Definition: svgawin.c:103
int y
Definition: svgawin.c:104
void draw_cursor_under(int ox, int oy)
Definition: svgawin.c:621
int mouseb
Definition: svgawin.c:96

Referenced by ui_main_loop().

◆ rd_close_file()

void rd_close_file ( int  fd)

Definition at line 1758 of file svgawin.c.

1759{
1760 return;
1761}

◆ rd_lock_file()

BOOL rd_lock_file ( int  fd,
int  start,
int  len 
)

Definition at line 1782 of file svgawin.c.

1783{
1784 return False;
1785}

◆ rd_lseek_file()

int rd_lseek_file ( int  fd,
int  offset 
)

Definition at line 1776 of file svgawin.c.

1777{
1778 return 0;
1779}

◆ rd_open_file()

int rd_open_file ( char filename)

Definition at line 1752 of file svgawin.c.

1753{
1754 return 0;
1755}

◆ rd_pstcache_mkdir()

BOOL rd_pstcache_mkdir ( void  )

Definition at line 1746 of file svgawin.c.

1747{
1748 return 0;
1749}

◆ rd_read_file()

int rd_read_file ( int  fd,
void ptr,
int  len 
)

Definition at line 1764 of file svgawin.c.

1765{
1766 return 0;
1767}

◆ rd_write_file()

int rd_write_file ( int  fd,
void ptr,
int  len 
)

Definition at line 1770 of file svgawin.c.

1771{
1772 return 0;
1773}

◆ read_keyboard_state()

unsigned int read_keyboard_state ( void  )

Definition at line 1626 of file svgawin.c.

1627{
1628 return 0;
1629}

◆ rop()

int rop ( int  rop,
int  src,
int  dst 
)

Definition at line 169 of file svgawin.c.

170{
171 switch (rop)
172 {
173 case 0x0: return 0;
174 case 0x1: return ~(src | dst);
175 case 0x2: return (~src) & dst;
176 case 0x3: return ~src;
177 case 0x4: return src & (~dst);
178 case 0x5: return ~(dst);
179 case 0x6: return src ^ dst;
180 case 0x7: return ~(src & dst);
181 case 0x8: return src & dst;
182 case 0x9: return ~(src) ^ dst;
183 case 0xa: return dst;
184 case 0xb: return (~src) | dst;
185 case 0xc: return src;
186 case 0xd: return src | (~dst);
187 case 0xe: return src | dst;
188 case 0xf: return ~0;
189 }
190 return dst;
191}
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

Referenced by draw_cursor(), rop(), and set_pixel().

◆ save_licence()

void save_licence ( uint8 data,
int  length 
)

Definition at line 1673 of file svgawin.c.

1674{
1675}

◆ set_pixel()

void set_pixel ( int  x,
int  y,
int  pixel,
int  op 
)

Definition at line 217 of file svgawin.c.

218{
219 if (x >= clip_startx && x < clip_endx && y >= clip_starty && y < clip_endy)
220 {
221 if (x >= 0 && x < g_width && y >= 0 && y < g_height)
222 {
223 if (op == 0x0)
224 pixel = 0;
225 else if (op == 0xf)
226 pixel = -1;
227 else if (op != 0xc)
228 pixel = rop(op, pixel, get_pixel(x, y));
229 if (sdata != 0)
230 {
231 if (g_server_Bpp == 1)
232 sdata[y * g_width + x] = pixel;
233 else if (g_server_Bpp == 2)
234 ((uint16*)sdata)[y * g_width + x] = pixel;
235 }
236 else
237 {
238 vga_setcolor(pixel);
239 vga_drawpixel(x, y);
240 }
241 }
242 }
243}
UINT op
Definition: effect.c:236
int clip_startx
Definition: svgawin.c:87
int clip_starty
Definition: svgawin.c:88
int clip_endy
Definition: svgawin.c:90

Referenced by draw_glyph(), fill_rect(), ui_line(), ui_memblt(), ui_patblt(), and ui_screenblt().

◆ set_pixel2()

void set_pixel2 ( int  x,
int  y,
int  pixel,
uint8 data,
int  width,
int  bpp 
)

Definition at line 259 of file svgawin.c.

260{
261 if (bpp == 8)
262 data[y * width + x] = pixel;
263 else if (bpp == 16)
264 ((uint16*)data)[y * width + x] = pixel;
265}

Referenced by draw_cursor(), and ui_screenblt().

◆ set_pixel_on()

void set_pixel_on ( uint8 data,
int  x,
int  y,
int  width,
int  bpp,
int  pixel 
)

Definition at line 308 of file svgawin.c.

309{
310 if (bpp == 8)
311 {
312 data[y * width + x] = pixel;
313 }
314}

Referenced by ui_create_cursor(), and ui_create_glyph().

◆ setled()

static void setled ( int  mask,
int  state 
)
static

Definition at line 146 of file svgawin.c.

147{
148 int fd;
149 long int leds;
150
151 if (( fd=open("/dev/console", O_NOCTTY)) != -1 )
152 {
153 if (ioctl (fd, KDGETLED, &leds) != -1)
154 {
155 leds &= 7;
156 if (state)
157 leds |= mask;
158 else
159 leds &= ~mask;
160 ioctl (fd, KDSETLED, leds);
161 }
162 close(fd);
163 }
164}
#define open
Definition: acwin.h:95
#define close
Definition: acwin.h:98
static int state
Definition: maze.c:121
GLenum GLint GLuint mask
Definition: glext.h:6028
static int fd
Definition: io.c:51
#define ioctl
Definition: wintirpc.h:60

Referenced by key_event().

◆ ui_begin_update()

void ui_begin_update ( void  )

Definition at line 1637 of file svgawin.c.

1638{
1639}

◆ ui_bell()

void ui_bell ( void  )

Definition at line 1036 of file svgawin.c.

1037{
1038}

◆ ui_create_bitmap()

HBITMAP ui_create_bitmap ( int  width,
int  height,
uint8 data 
)

Definition at line 1146 of file svgawin.c.

1147{
1148 bitmap* b;
1149
1150 b = (bitmap*)xmalloc(sizeof(bitmap));
1151 b->data = (uint8*)xmalloc(width * height * g_server_Bpp);
1152 b->width = width;
1153 b->height = height;
1154 b->Bpp = g_server_Bpp;
1155 copy_mem(b->data, data, width * height * g_server_Bpp);
1156 return (void*)b;
1157}
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define b
Definition: ke_i.h:79

◆ ui_create_colourmap()

void * ui_create_colourmap ( COLOURMAP colours)

Definition at line 1110 of file svgawin.c.

1111{
1112 int i = 0;
1113 int n = colours->ncolours;
1114 COLOURENTRY* c = colours->colours;
1115 int* cmap = (int*)xmalloc(3 * 256 * sizeof (int));
1116 if (n > 256)
1117 n = 256;
1118 bzero(cmap, 256 * 3 * sizeof (int));
1119 for (i = 0; i < (3 * n); c++)
1120 {
1121 cmap[i++] = (c->red) >> 2;
1122 cmap[i++] = (c->green) >> 2;
1123 cmap[i++] = (c->blue) >> 2;
1124 }
1125 return cmap;
1126}
#define bzero(s, n)
Definition: various.h:27
const GLubyte * c
Definition: glext.h:8905
uint16 ncolours
Definition: types.h:66
COLOURENTRY * colours
Definition: types.h:67

◆ ui_create_cursor()

void * ui_create_cursor ( unsigned int  x,
unsigned int  y,
int  width,
int  height,
uint8 andmask,
uint8 xormask 
)

Definition at line 1566 of file svgawin.c.

1569{
1570 tcursor* c;
1571 int i;
1572 int j;
1573
1574 c = (tcursor*)xmalloc(sizeof(tcursor));
1575 memset(c, 0, sizeof(tcursor));
1576 c->w = width;
1577 c->h = height;
1578 c->x = x;
1579 c->y = y;
1580 for (i = 0; i < 32; i++)
1581 {
1582 for (j = 0; j < 32; j++)
1583 {
1584 if (is_pixel_on(andmask, j, i, 32, 1))
1585 set_pixel_on(c->andmask, j, 31 - i, 32, 8, 255);
1586 if (is_pixel_on(xormask, j, i, 32, 24))
1587 set_pixel_on(c->xormask, j, 31 - i, 32, 8, 255);
1588 }
1589 }
1590 return (void*)c;
1591}
#define c
Definition: ke_i.h:80
void set_pixel_on(uint8 *data, int x, int y, int width, int bpp, int pixel)
Definition: svgawin.c:308

◆ ui_create_glyph()

void * ui_create_glyph ( int  width,
int  height,
uint8 data 
)

Definition at line 1048 of file svgawin.c.

1049{
1050 int i, j;
1051 uint8* glyph_data;
1052 bitmap* the_glyph;
1053
1054 glyph_data = (uint8*)xmalloc(width * height);
1055 the_glyph = (bitmap*)xmalloc(sizeof(bitmap));
1056 the_glyph->width = width;
1057 the_glyph->height = height;
1058 the_glyph->data = glyph_data;
1059 memset(glyph_data, 0, width * height);
1060 for (i = 0; i < height; i++)
1061 for (j = 0; j < width; j++)
1062 if (is_pixel_on(data, j, i, width, 1))
1063 set_pixel_on(glyph_data, j, i, width, 8, 255);
1064 return the_glyph;
1065}

◆ ui_create_window()

int ui_create_window ( void  )

Definition at line 870 of file svgawin.c.

871{
872 int vgamode;
873 int i;
874
875 vgamode = G800x600x256;
876 if (g_width == 640 && g_height == 480)
877 {
878 if (g_server_Bpp == 1)
879 vgamode = G640x480x256;
880 else if (g_server_Bpp == 2)
881 vgamode = G640x480x64K;
882 }
883 else if (g_width == 800 && g_height == 600)
884 {
885 if (g_server_Bpp == 1)
886 vgamode = G800x600x256;
887 else if (g_server_Bpp == 2)
888 vgamode = G800x600x64K;
889 }
890 else if (g_width == 1024 && g_height == 768)
891 {
892 if (g_server_Bpp == 1)
893 vgamode = G1024x768x256;
894 else if (g_server_Bpp == 2)
895 vgamode = G1024x768x64K;
896 }
897 else
898 {
899 error("Invalid width / height");
900 return 0;
901 }
903 if (!vga_hasmode(vgamode))
904 {
905 error("Graphics unavailable");
906 return 0;
907 }
908 vga_setmousesupport(1);
909 mouse_setposition(g_width / 2, g_height / 2);
910 vga_setmode(vgamode);
911 if (keyboard_init())
912 {
913 error("Keyboard unavailable");
914 return 0;
915 }
916 keyboard_seteventhandler(key_event);
917 if (use_accel)
918 {
919 i = vga_ext_set(VGA_EXT_AVAILABLE, VGA_AVAIL_ACCEL);
920 if (i & ACCELFLAG_PUTIMAGE)
921 has_put_image = 1;
922 if (i & ACCELFLAG_SCREENCOPY)
923 has_screen_copy = 1;
924 if (i & ACCELFLAG_FILLBOX)
925 has_fill_box = 1;
926 printf("accel %d\n", i);
927 }
930 return 1;
931}
void key_event(int scancode, int pressed)
Definition: svgawin.c:773
void ui_reset_clip(void)
Definition: svgawin.c:1092

Referenced by main().

◆ ui_deinit()

void ui_deinit ( void  )

Definition at line 864 of file svgawin.c.

865{
867}
static uint8 * desk_save
Definition: svgawin.c:67

Referenced by main().

◆ ui_desktop_restore()

void ui_desktop_restore ( uint32  offset,
int  x,
int  y,
int  cx,
int  cy 
)

Definition at line 1419 of file svgawin.c.

1420{
1421 uint8* p;
1422
1423 if (offset > 0x38400)
1424 offset = 0;
1425 if (offset + cx * cy > 0x38400)
1426 return;
1428 ui_paint_bitmap(x, y, cx, cy, cx, cy, p);
1429}
void ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, uint8 *data)
Definition: svgawin.c:1553

◆ ui_desktop_save()

void ui_desktop_save ( uint32  offset,
int  x,
int  y,
int  cx,
int  cy 
)

Definition at line 1432 of file svgawin.c.

1433{
1434 uint8* p;
1435
1436 if (offset > 0x38400)
1437 offset = 0;
1438 if (offset + cx * cy > 0x38400)
1439 return;
1440 if (contains_mouse(x, y, cx, cy))
1443 get_rect(x, y, cx, cy, p);
1444}
int contains_mouse(int x, int y, int cx, int cy)
Definition: svgawin.c:540
void get_rect(int x, int y, int cx, int cy, uint8 *p)
Definition: svgawin.c:575

◆ ui_destblt()

void ui_destblt ( uint8  opcode,
int  x,
int  y,
int  cx,
int  cy 
)

Definition at line 1524 of file svgawin.c.

1525{
1526 if (warp_coords(&x, &y, &cx, &cy, NULL, NULL))
1527 {
1528 if (contains_mouse(x, y, cx, cy))
1530 fill_rect(x, y, cx, cy, -1, opcode);
1531 cache_rect(x, y, cx, cy, False);
1532 }
1533}
void cache_rect(int x, int y, int cx, int cy, int do_warp)
Definition: svgawin.c:704
void fill_rect(int x, int y, int cx, int cy, int colour, int opcode)
Definition: svgawin.c:552

◆ ui_destroy_bitmap()

void ui_destroy_bitmap ( void bmp)

Definition at line 1082 of file svgawin.c.

1083{
1084 bitmap* b;
1085
1086 b = (bitmap*)bmp;
1087 xfree(b->data);
1088 xfree(b);
1089}
BITMAP bmp
Definition: alphablend.c:62

◆ ui_destroy_colourmap()

void ui_destroy_colourmap ( HCOLOURMAP  map)

Definition at line 1129 of file svgawin.c.

1130{
1131 if (colmap == map)
1132 colmap = 0;
1133 xfree(map);
1134}
Definition: _map.h:48
static uint32 * colmap
Definition: svgawin.c:66

◆ ui_destroy_cursor()

void ui_destroy_cursor ( void cursor)

Definition at line 1594 of file svgawin.c.

1595{
1596 if (cursor != NULL)
1597 xfree(cursor);
1598}
const char cursor[]
Definition: icontest.c:13

◆ ui_destroy_glyph()

void ui_destroy_glyph ( void glyph)

Definition at line 1068 of file svgawin.c.

1069{
1070 bitmap* the_glyph;
1071
1072 the_glyph = (bitmap*)glyph;
1073 if (the_glyph != NULL)
1074 {
1075 if (the_glyph->data != NULL)
1076 xfree(the_glyph->data);
1077 xfree(the_glyph);
1078 }
1079}

◆ ui_destroy_window()

void ui_destroy_window ( void  )

Definition at line 934 of file svgawin.c.

935{
936 keyboard_close(); /* Don't forget this! */
937 vga_setmode(TEXT);
938 if (sdata != 0)
939 xfree(sdata);
940}
#define TEXT(s)
Definition: k32.h:26

Referenced by main().

◆ ui_draw_text()

void ui_draw_text ( uint8  font,
uint8  flags,
uint8  opcode,
int  mixmode,
int  x,
int  y,
int  clipx,
int  clipy,
int  clipcx,
int  clipcy,
int  boxx,
int  boxy,
int  boxcx,
int  boxcy,
BRUSH brush,
int  bgcolour,
int  fgcolour,
uint8 text,
uint8  length 
)

Definition at line 1205 of file svgawin.c.

1210{
1211 int i;
1212 int j;
1213 int xyoffset;
1214 DATABLOB* entry;
1215 FONTGLYPH* glyph;
1216
1217 if (boxcx > 1)
1218 {
1219 if (contains_mouse(boxx, boxy, boxcx, boxcy))
1221 fill_rect(boxx, boxy, boxcx, boxcy, bgcolour, 0xc);
1222 }
1223 else
1224 {
1225 if (contains_mouse(clipx, clipy, clipcx, clipcy))
1227 if (mixmode == MIX_OPAQUE)
1228 fill_rect(clipx, clipy, clipcx, clipcy, bgcolour, 0xc);
1229 }
1230
1231 /* Paint text, character by character */
1232 for (i = 0; i < length;)
1233 {
1234 switch (text[i])
1235 {
1236 case 0xff:
1237 if (i + 2 < length)
1238 cache_put_text(text[i + 1], text, text[i + 2]);
1239 else
1240 {
1241 error("this shouldn't be happening\n");
1242 exit(1);
1243 }
1244 /* this will move pointer from start to first character after FF command */
1245 length -= i + 3;
1246 text = &(text[i + 3]);
1247 i = 0;
1248 break;
1249
1250 case 0xfe:
1251 entry = cache_get_text(text[i + 1]);
1252 if (entry != NULL)
1253 {
1254 if ((((uint8 *) (entry->data))[1] == 0) && (!(flags & TEXT2_IMPLICIT_X)))
1255 {
1256 if (flags & TEXT2_VERTICAL)
1257 y += text[i + 2];
1258 else
1259 x += text[i + 2];
1260 }
1261 for (j = 0; j < entry->size; j++)
1262 DO_GLYPH(((uint8 *) (entry->data)), j);
1263 }
1264 if (i + 2 < length)
1265 i += 3;
1266 else
1267 i += 2;
1268 length -= i;
1269 /* this will move pointer from start to first character after FE command */
1270 text = &(text[i]);
1271 i = 0;
1272 break;
1273
1274 default:
1275 DO_GLYPH(text, i);
1276 i++;
1277 break;
1278 }
1279 }
1280 if (boxcx > 1)
1281 cache_rect(boxx, boxy, boxcx, boxcy, True);
1282 else
1283 cache_rect(clipx, clipy, clipcx, clipcy, True);
1284}
void cache_put_text(uint8 cache_id, void *data, int length)
Definition: cache.c:335
DATABLOB * cache_get_text(uint8 cache_id)
Definition: cache.c:325
#define MIX_OPAQUE
Definition: constants.h:273
#define True
Definition: types.h:24
const WCHAR * text
Definition: package.c:1799
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
uint32_t entry
Definition: isohybrid.c:63
#define exit(n)
Definition: config.h:202
#define DO_GLYPH(ttext, idx)
Definition: svgawin.c:1174

◆ ui_ellipse()

void ui_ellipse ( uint8  opcode,
uint8  fillmode,
int  x,
int  y,
int  cx,
int  cy,
BRUSH brush,
int  bgcolour,
int  fgcolour 
)

Definition at line 1660 of file svgawin.c.

1663{
1664}

◆ ui_end_update()

void ui_end_update ( void  )

Definition at line 1642 of file svgawin.c.

1643{
1645 draw_cursor();
1646}
void draw_cache_rects(void)
Definition: svgawin.c:748

◆ ui_get_numlock_state()

uint16 ui_get_numlock_state ( unsigned int  state)

Definition at line 1620 of file svgawin.c.

1621{
1622 return 0;
1623}

◆ ui_init()

int ui_init ( void  )

Definition at line 855 of file svgawin.c.

856{
857 vga_init();
858 memset(&mcursor, 0, sizeof(tcursor));
859 desk_save = (uint8*)xmalloc(0x38400 * g_server_Bpp);
860 return 1;
861}

Referenced by main().

◆ ui_line()

void ui_line ( uint8  opcode,
int  startx,
int  starty,
int  endx,
int  endy,
PEN pen 
)

Definition at line 1288 of file svgawin.c.

1290{
1291 int dx;
1292 int dy;
1293 int incx;
1294 int incy;
1295 int dpr;
1296 int dpru;
1297 int p;
1298 int left;
1299 int top;
1300 int right;
1301 int bottom;
1302
1303 if (startx > endx)
1304 {
1305 dx = startx - endx;
1306 incx = -1;
1307 left = endx;
1308 right = startx;
1309 }
1310 else
1311 {
1312 dx = endx - startx;
1313 incx = 1;
1314 left = startx;
1315 right = endx;
1316 }
1317 if (starty > endy)
1318 {
1319 dy = starty - endy;
1320 incy = -1;
1321 top = endy;
1322 bottom = starty;
1323 }
1324 else
1325 {
1326 dy = endy - starty;
1327 incy = 1;
1328 top = starty;
1329 bottom = endy;
1330 }
1331 if (contains_mouse(left, top, (right - left) + 1, (bottom - top) + 1))
1333 if (dx >= dy)
1334 {
1335 dpr = dy << 1;
1336 dpru = dpr - (dx << 1);
1337 p = dpr - dx;
1338 for (; dx >= 0; dx--)
1339 {
1340 set_pixel(startx, starty, pen->colour, opcode);
1341 if (p > 0)
1342 {
1343 startx += incx;
1344 starty += incy;
1345 p += dpru;
1346 }
1347 else
1348 {
1349 startx += incx;
1350 p += dpr;
1351 }
1352 }
1353 }
1354 else
1355 {
1356 dpr = dx << 1;
1357 dpru = dpr - (dy << 1);
1358 p = dpr - dy;
1359 for (; dy >= 0; dy--)
1360 {
1361 set_pixel(startx, starty, pen->colour, opcode);
1362 if (p > 0)
1363 {
1364 startx += incx;
1365 starty += incy;
1366 p += dpru;
1367 }
1368 else
1369 {
1370 starty += incy;
1371 p += dpr;
1372 }
1373 }
1374 }
1375 cache_rect(left, top, (right - left) + 1, (bottom - top) + 1, True);
1376}
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
GLint GLint bottom
Definition: glext.h:7726
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
uint32 colour
Definition: types.h:86

◆ ui_main_loop()

BOOL ui_main_loop ( void  )

Definition at line 1002 of file svgawin.c.

1003{
1004 int sel;
1005 fd_set rfds;
1006
1007 if (!rdp_connect(g_servername, RDP_LOGON_NORMAL, "", "", "", ""))
1008 return False;
1009 UpAndRunning = 1;
1010 FD_ZERO(&rfds);
1011 FD_SET(g_sock, &rfds);
1012 sel = vga_waitevent(3, &rfds, NULL, NULL, NULL);
1013 while (sel >= 0)
1014 {
1015 if (sel & 1) /* mouse */
1016 {
1017 process_mouse();
1018 }
1019 else if (sel & 2) /* keyboard */
1020 {
1022 }
1023 else
1024 {
1026 return True; /* ok */
1027 }
1028 FD_ZERO(&rfds);
1029 FD_SET(g_sock, &rfds);
1030 sel = vga_waitevent(3, &rfds, NULL, NULL, NULL);
1031 }
1032 return True;
1033}
#define RDP_LOGON_NORMAL
Definition: precomp.h:24
RD_BOOL rdp_connect(char *server, uint32 flags, char *domain, char *password, char *command, char *directory, RD_BOOL reconnect)
Definition: rdp.c:1742
RD_BOOL rdp_loop(RD_BOOL *deactivated, uint32 *ext_disc_reason)
Definition: rdp.c:1695
Definition: winsock.h:66
int deactivated
Definition: svgawin.c:63
uint32 ext_disc_reason
Definition: svgawin.c:64
void process_keyboard(void)
Definition: svgawin.c:995
void process_mouse(void)
Definition: svgawin.c:943
int g_sock
Definition: svgawin.c:62
#define FD_ZERO(set)
Definition: winsock.h:96
#define FD_SET(fd, set)
Definition: winsock.h:89

Referenced by main().

◆ ui_memblt()

void ui_memblt ( uint8  opcode,
int  x,
int  y,
int  cx,
int  cy,
HBITMAP  src,
int  srcx,
int  srcy 
)

Definition at line 1387 of file svgawin.c.

1389{
1390 bitmap* b;
1391 int i;
1392 int j;
1393 int pixel;
1394
1395 if (warp_coords(&x, &y, &cx, &cy, &srcx, &srcy))
1396 {
1397 if (contains_mouse(x, y, cx, cy))
1399 b = (bitmap*)src;
1400 if (opcode == 0xc)
1401 accel_draw_box(x, y, cx, cy, get_ptr(srcx, srcy, b->data, b->width, g_server_bpp),
1402 b->width * g_server_Bpp);
1403 else
1404 {
1405 for (i = 0; i < cy; i++)
1406 {
1407 for (j = 0; j < cx; j++)
1408 {
1409 pixel = get_pixel2(srcx + j, srcy + i, b->data, b->width, g_server_bpp);
1410 set_pixel(x + j, y + i, pixel, opcode);
1411 }
1412 }
1413 }
1414 cache_rect(x, y, cx, cy, False);
1415 }
1416}
int get_pixel2(int x, int y, uint8 *data, int width, int bpp)
Definition: svgawin.c:247
void accel_draw_box(int x, int y, int cx, int cy, uint8 *data, int line_size)
Definition: svgawin.c:402

◆ ui_move_pointer()

void ui_move_pointer ( int  x,
int  y 
)

Definition at line 1536 of file svgawin.c.

1537{
1538}

◆ ui_paint_bitmap()

void ui_paint_bitmap ( int  x,
int  y,
int  cx,
int  cy,
int  width,
int  height,
uint8 data 
)

Definition at line 1553 of file svgawin.c.

1555{
1556 if (warp_coords(&x, &y, &cx, &cy, NULL, NULL))
1557 {
1558 if (contains_mouse(x, y, cx, cy))
1561 cache_rect(x, y, cx, cy, False);
1562 }
1563}

Referenced by ui_desktop_restore().

◆ ui_patblt()

void ui_patblt ( uint8  opcode,
int  x,
int  y,
int  cx,
int  cy,
BRUSH brush,
int  bgcolour,
int  fgcolour 
)

Definition at line 1491 of file svgawin.c.

1493{
1494 int i;
1495 int j;
1496 uint8 ipattern[8];
1497
1498 if (warp_coords(&x, &y, &cx, &cy, NULL, NULL))
1499 {
1500 if (contains_mouse(x, y, cx, cy))
1502 switch (brush->style)
1503 {
1504 case 0:
1505 fill_rect(x, y, cx, cy, fgcolour, opcode);
1506 break;
1507 case 3:
1508 for (i = 0; i < 8; i++)
1509 ipattern[i] = ~brush->pattern[7 - i];
1510 for (i = 0; i < cy; i++)
1511 for (j = 0; j < cx; j++)
1512 if (is_pixel_on(ipattern, (x + j + brush->xorigin) % 8,
1513 (y + i + brush->yorigin) % 8, 8, 1))
1514 set_pixel(x + j, y + i, fgcolour, opcode);
1515 else
1516 set_pixel(x + j, y + i, bgcolour, opcode);
1517 break;
1518 }
1519 cache_rect(x, y, cx, cy, False);
1520 }
1521}
#define for
Definition: utility.h:88

◆ ui_polygon()

void ui_polygon ( uint8  opcode,
uint8  fillmode,
POINT point,
int  npoints,
BRUSH brush,
int  bgcolour,
int  fgcolour 
)

Definition at line 1649 of file svgawin.c.

1651{
1652}

◆ ui_polyline()

void ui_polyline ( uint8  opcode,
POINT points,
int  npoints,
PEN pen 
)

Definition at line 1655 of file svgawin.c.

1656{
1657}

◆ ui_rect()

void ui_rect ( int  x,
int  y,
int  cx,
int  cy,
int  colour 
)

Definition at line 1447 of file svgawin.c.

1448{
1449 if (warp_coords(&x, &y, &cx, &cy, NULL, NULL))
1450 {
1451 if (contains_mouse(x, y, cx, cy))
1453 accel_fill_rect(x, y, cx, cy, colour);
1454 cache_rect(x, y, cx, cy, False);
1455 }
1456}

◆ ui_reset_clip()

void ui_reset_clip ( void  )

Definition at line 1092 of file svgawin.c.

1093{
1094 clip_startx = 0;
1095 clip_starty = 0;
1098}
int clip_endx
Definition: svgawin.c:89

Referenced by ui_create_window().

◆ ui_resize_window()

void ui_resize_window ( void  )

Definition at line 1632 of file svgawin.c.

1633{
1634}

◆ ui_screenblt()

void ui_screenblt ( uint8  opcode,
int  x,
int  y,
int  cx,
int  cy,
int  srcx,
int  srcy 
)

Definition at line 1459 of file svgawin.c.

1461{
1462 int i;
1463 int j;
1464 uint8* temp;
1465
1466 if (x == srcx && y == srcy)
1467 return;
1468 if (warp_coords(&x, &y, &cx, &cy, &srcx, &srcy))
1469 {
1470 if (contains_mouse(x, y, cx, cy) || contains_mouse(srcx, srcy, cx, cy))
1472 if (opcode == 0xc) /* copy */
1473 accel_screen_copy(x, y, cx, cy, srcx, srcy);
1474 else
1475 {
1477 for (i = 0; i < cy; i++)
1478 for (j = 0; j < cx; j++)
1479 set_pixel2(j, i, get_pixel(srcx + j, srcy + i), temp, cx, g_server_bpp);
1480 for (i = 0; i < cy; i++)
1481 for (j = 0; j < cx; j++)
1482 set_pixel(x + j, y + i, get_pixel2(j, i, temp, cx, g_server_bpp), opcode);
1483 xfree(temp);
1484 }
1485 cache_rect(x, y, cx, cy, False);
1486 draw_cache_rects(); // draw them all so screen is not jumpy
1487 }
1488}
void accel_screen_copy(int x, int y, int cx, int cy, int srcx, int srcy)
Definition: svgawin.c:479

◆ ui_select()

int ui_select ( int  in)

Definition at line 1041 of file svgawin.c.

1042{
1043 g_sock = in;
1044 return 1;
1045}
GLuint in
Definition: glext.h:9616

◆ ui_set_clip()

void ui_set_clip ( int  x,
int  y,
int  cx,
int  cy 
)

Definition at line 1101 of file svgawin.c.

1102{
1103 clip_startx = x;
1104 clip_starty = y;
1105 clip_endx = x + cx;
1106 clip_endy = y + cy;
1107}

◆ ui_set_colourmap()

void ui_set_colourmap ( void map)

Definition at line 1137 of file svgawin.c.

1138{
1139 if (colmap != 0)
1140 xfree(colmap);
1141 vga_setpalvec(0, 256, (int*)map);
1142 colmap = map;
1143}

◆ ui_set_cursor()

void ui_set_cursor ( void cursor)

Definition at line 1601 of file svgawin.c.

1602{
1603 int x;
1604 int y;
1605 int ox;
1606 int oy;
1607
1608 ox = mousex;
1609 oy = mousey;
1610 x = mousex + mcursor.x;
1611 y = mousey + mcursor.y;
1612 memcpy(&mcursor, cursor, sizeof(tcursor));
1613 mousex = x - mcursor.x;
1614 mousey = y - mcursor.y;
1615 draw_cursor_under(ox, oy);
1616 draw_cursor();
1617}

◆ ui_set_null_cursor()

void ui_set_null_cursor ( void  )

Definition at line 1541 of file svgawin.c.

1542{
1544 mousex = mousex - mcursor.x;
1545 mousey = mousey - mcursor.y;
1546 memset(&mcursor, 0, sizeof(mcursor));
1547 memset(mcursor.andmask, 255, sizeof(mcursor.andmask));
1548 memset(mcursor.xormask, 0, sizeof(mcursor.xormask));
1549 draw_cursor();
1550}

◆ ui_triblt()

void ui_triblt ( uint8  opcode,
int  x,
int  y,
int  cx,
int  cy,
HBITMAP  src,
int  srcx,
int  srcy,
BRUSH brush,
int  bgcolour,
int  fgcolour 
)

Definition at line 1379 of file svgawin.c.

1382{
1383 // non used
1384}

◆ unimpl()

void unimpl ( char format,
  ... 
)

Definition at line 1725 of file svgawin.c.

1726{
1727 va_list ap;
1728
1729 fprintf(stderr, "NOT IMPLEMENTED: ");
1730 va_start(ap, format);
1732 va_end(ap);
1733}

◆ warning()

void warning ( char format,
  ... 
)

Definition at line 1714 of file svgawin.c.

1715{
1716 va_list ap;
1717
1718 fprintf(stderr, "WARNING: ");
1719 va_start(ap, format);
1721 va_end(ap);
1722}

◆ warp_coords()

int warp_coords ( int x,
int y,
int cx,
int cy,
int srcx,
int srcy 
)

Definition at line 317 of file svgawin.c.

318{
319 int dx;
320 int dy;
321// int lx = *x, ly = *y, lcx = *cx, lcy = *cy;
322
323 if (clip_startx > *x)
324 dx = clip_startx - *x;
325 else
326 dx = 0;
327 if (clip_starty > *y)
328 dy = clip_starty - *y;
329 else
330 dy = 0;
331 if (*x + *cx > clip_endx)
332 *cx = (*cx - ((*x + *cx) - clip_endx)) /*+ 1*/;
333 if (*y + *cy > clip_endy)
334 *cy = (*cy - ((*y + *cy) - clip_endy)) /*+ 1*/;
335 *cx = *cx - dx;
336 *cy = *cy - dy;
337 if (*cx <= 0)
338 return False;
339 if (*cy <= 0)
340 return False;
341 *x = *x + dx;
342 *y = *y + dy;
343 if (srcx != NULL)
344 *srcx = *srcx + dx;
345 if (srcy != NULL)
346 *srcy = *srcy + dy;
347
348// if (*x != lx || *y != ly || *cx != lcx || *cy != lcy)
349// printf("%d %d %d %d to %d %d %d %d\n", lx, ly, lcx, lcy, *x, *y, *cx, *cy);
350
351 return True;
352}

Referenced by cache_rect(), fill_rect(), ui_destblt(), ui_memblt(), ui_paint_bitmap(), ui_patblt(), ui_rect(), and ui_screenblt().

◆ xfree()

◆ xmalloc()

void * xmalloc ( int  size)

Definition at line 1690 of file svgawin.c.

1691{
1692 return malloc(size);
1693}
#define malloc
Definition: debug_ros.c:4
GLsizeiptr size
Definition: glext.h:5919

Referenced by accel_fill_rect(), accel_screen_copy(), cache_rect(), ui_create_bitmap(), ui_create_colourmap(), ui_create_cursor(), ui_create_glyph(), ui_create_window(), ui_init(), and ui_screenblt().

◆ xrealloc()

void * xrealloc ( void in_val,
int  size 
)

Definition at line 1684 of file svgawin.c.

1685{
1686 return realloc(in_val, size);
1687}
#define realloc
Definition: debug_ros.c:6

◆ xstrdup()

char * xstrdup ( const char s)

Definition at line 1702 of file svgawin.c.

1703{
1704 char * mem = strdup(s);
1705 if (mem == NULL)
1706 {
1707 perror("strdup");
1708 exit(1);
1709 }
1710 return mem;
1711}
_CRTIMP void __cdecl perror(_In_opt_z_ const char *_ErrMsg)
_Check_return_ _CRTIMP char *__cdecl strdup(_In_opt_z_ const char *_Src)
Definition: mem.c:156

Variable Documentation

◆ capslock

int capslock
static

Definition at line 72 of file svgawin.c.

Referenced by key_event().

◆ clip_endx

int clip_endx

Definition at line 89 of file svgawin.c.

Referenced by ui_reset_clip(), ui_set_clip(), and warp_coords().

◆ clip_endy

int clip_endy

Definition at line 90 of file svgawin.c.

Referenced by set_pixel(), ui_reset_clip(), ui_set_clip(), and warp_coords().

◆ clip_startx

int clip_startx

Definition at line 87 of file svgawin.c.

Referenced by set_pixel(), ui_reset_clip(), ui_set_clip(), and warp_coords().

◆ clip_starty

int clip_starty

Definition at line 88 of file svgawin.c.

Referenced by set_pixel(), ui_reset_clip(), ui_set_clip(), and warp_coords().

◆ colmap

uint32* colmap = 0
static

Definition at line 66 of file svgawin.c.

Referenced by ui_destroy_colourmap(), and ui_set_colourmap().

◆ deactivated

◆ desk_save

uint8* desk_save = 0
static

Definition at line 67 of file svgawin.c.

Referenced by ui_deinit(), ui_desktop_restore(), ui_desktop_save(), and ui_init().

◆ ext_disc_reason

◆ g_argc

int g_argc = 0

Definition at line 59 of file svgawin.c.

Referenced by parse_parameters().

◆ g_argv

char** g_argv = 0

Definition at line 60 of file svgawin.c.

Referenced by parse_parameters().

◆ g_bitmap_cache

int g_bitmap_cache = 1

Definition at line 47 of file svgawin.c.

◆ g_bitmap_cache_persist_enable

int g_bitmap_cache_persist_enable = False

Definition at line 48 of file svgawin.c.

◆ g_bitmap_cache_precache

int g_bitmap_cache_precache = True

Definition at line 49 of file svgawin.c.

◆ g_bitmap_compression

int g_bitmap_compression = 1

Definition at line 50 of file svgawin.c.

◆ g_console_session

int g_console_session = 0

Definition at line 52 of file svgawin.c.

◆ g_desktop_save

int g_desktop_save = 1

Definition at line 45 of file svgawin.c.

◆ g_draw_mouse

int g_draw_mouse = 1
static

Definition at line 112 of file svgawin.c.

Referenced by draw_cursor(), and draw_cursor_under().

◆ g_encryption

int g_encryption = 1

Definition at line 44 of file svgawin.c.

◆ g_height

int g_height = 600

◆ g_hostname

char g_hostname[16] = ""

Definition at line 39 of file svgawin.c.

Referenced by get_username_and_hostname(), and parse_parameters().

◆ g_keyboard_functionkeys

int g_keyboard_functionkeys = 0xc

Definition at line 56 of file svgawin.c.

◆ g_keyboard_subtype

int g_keyboard_subtype = 0x0

Definition at line 55 of file svgawin.c.

◆ g_keyboard_type

int g_keyboard_type = 0x4

Definition at line 54 of file svgawin.c.

◆ g_keylayout

int g_keylayout = 0x409

Definition at line 53 of file svgawin.c.

◆ g_polygon_ellipse_orders

int g_polygon_ellipse_orders = 0

Definition at line 46 of file svgawin.c.

◆ g_rdp5_performanceflags

int g_rdp5_performanceflags = 0

Definition at line 51 of file svgawin.c.

◆ g_redirect

BOOL g_redirect = False

Definition at line 115 of file svgawin.c.

◆ g_redirect_cookie

char g_redirect_cookie[128]

Definition at line 120 of file svgawin.c.

◆ g_redirect_domain

char g_redirect_domain[16]

Definition at line 117 of file svgawin.c.

◆ g_redirect_flags

uint32 g_redirect_flags = 0

Definition at line 121 of file svgawin.c.

◆ g_redirect_password

char g_redirect_password[64]

Definition at line 118 of file svgawin.c.

◆ g_redirect_server

char g_redirect_server[64]

Definition at line 116 of file svgawin.c.

◆ g_redirect_username

char g_redirect_username[64]

Definition at line 119 of file svgawin.c.

◆ g_save_mem

int g_save_mem = 0
static

Definition at line 78 of file svgawin.c.

Referenced by parse_parameters(), and ui_create_window().

◆ g_server_bpp

◆ g_server_Bpp

◆ g_servername

char g_servername[128] = ""

Definition at line 65 of file svgawin.c.

Referenced by parse_parameters(), ui_main_loop(), and wWinMain().

◆ g_sock

int g_sock = 0

Definition at line 62 of file svgawin.c.

Referenced by ui_main_loop(), and ui_select().

◆ g_tcp_port_rdp

int g_tcp_port_rdp
extern

Definition at line 75 of file tcp.c.

Referenced by parse_parameters().

◆ g_use_rdp5

int g_use_rdp5 = 0

Definition at line 38 of file svgawin.c.

Referenced by parse_parameters().

◆ g_username

char g_username[64] = ""

Definition at line 40 of file svgawin.c.

Referenced by get_username_and_hostname(), and parse_parameters().

◆ g_width

◆ has_fill_box

int has_fill_box = 0
static

Definition at line 82 of file svgawin.c.

Referenced by accel_fill_rect(), and ui_create_window().

◆ has_put_image

int has_put_image = 0
static

Definition at line 84 of file svgawin.c.

Referenced by accel_draw_box(), and ui_create_window().

◆ has_screen_copy

int has_screen_copy = 0
static

Definition at line 83 of file svgawin.c.

Referenced by accel_screen_copy(), and ui_create_window().

◆ head_rect

myrect* head_rect = 0

Definition at line 142 of file svgawin.c.

Referenced by cache_rect(), and draw_cache_rects().

◆ mcursor

tcursor mcursor
static

Definition at line 110 of file svgawin.c.

Referenced by draw_cursor(), process_mouse(), ui_init(), ui_set_cursor(), and ui_set_null_cursor().

◆ mouse_under

uint8 mouse_under[32 *32 *4]

Definition at line 93 of file svgawin.c.

Referenced by draw_cursor(), and draw_cursor_under().

◆ mouseb

int mouseb = 0

Definition at line 96 of file svgawin.c.

Referenced by process_mouse().

◆ mousex

◆ mousey

◆ numlock

int numlock
static

Definition at line 71 of file svgawin.c.

Referenced by key_event().

◆ scrolllock

int scrolllock
static

Definition at line 73 of file svgawin.c.

Referenced by key_event().

◆ sdata

◆ UpAndRunning

int UpAndRunning = 0

Definition at line 61 of file svgawin.c.

Referenced by key_event(), process_keyboard(), process_mouse(), and ui_main_loop().

◆ use_accel

int use_accel = 1
static

Definition at line 81 of file svgawin.c.

Referenced by parse_parameters(), and ui_create_window().