Révision | 74a7bae47928022775830fb27bb433f621f3bb07 (tree) |
---|---|
l'heure | 2020-09-12 20:28:46 |
Auteur | Ruben Agin <phabrics@phab...> |
Commiter | Ruben Agin |
Checkpoint for final VNC code prep.
@@ -1,72 +0,0 @@ | ||
1 | -syntax: glob | |
2 | -INSTALL | |
3 | -Makefile.in | |
4 | -aclocal.m4 | |
5 | -autom4te.cache | |
6 | -compile | |
7 | -config.* | |
8 | -configure | |
9 | -depcomp | |
10 | -install-sh | |
11 | -libltdl | |
12 | -argz.m4 | |
13 | -libtool.m4 | |
14 | -ltargz.m4 | |
15 | -ltdl.m4 | |
16 | -ltoptions.m4 | |
17 | -ltsugar.m4 | |
18 | -ltversion.m4 | |
19 | -lt~obsolete.m4 | |
20 | -ltmain.sh | |
21 | -missing | |
22 | -ylwrap | |
23 | -Makefile | |
24 | -.deps | |
25 | -libtool | |
26 | -stamp-h1 | |
27 | -recode-host.* | |
28 | -tmeconfig.h | |
29 | -*.o | |
30 | -*.lo | |
31 | -*.a | |
32 | -*.la | |
33 | -*.lai | |
34 | -*.so | |
35 | -*.so.* | |
36 | -bus-device-auto.c | |
37 | -fb-xlat-auto.c | |
38 | -float-auto.c | |
39 | -ieee754-auto.h | |
40 | -ieee754-misc-auto.c | |
41 | -ieee754-ops-auto.c | |
42 | -ieee754-ops-auto.h | |
43 | -m6888x-auto.c | |
44 | -m68k-auto.h | |
45 | -m68k-bus-auto.c | |
46 | -m68k-insns-auto.c | |
47 | -m68k-opmap.c | |
48 | -sparc-auto.h | |
49 | -sparc-bus-auto.c | |
50 | -sparc-fpu-auto.c | |
51 | -sparc-insns-auto.c | |
52 | -sparc-vis-auto.c | |
53 | -memory-auto.c | |
54 | -memory-auto.h | |
55 | -shlibvar.h | |
56 | -tme-sun-eeprom | |
57 | -tme-sun-idprom | |
58 | -tme-preopen.txt | |
59 | -tme-plugins.txt | |
60 | -.libs | |
61 | -tmesh/tmesh | |
62 | -tmesh-input.c | |
63 | -TAGS | |
64 | -build* | |
65 | -*~ | |
66 | -./ | |
67 | -tmememory.h | |
68 | -*.tex | |
69 | -*.info | |
70 | -mdate-sh | |
71 | -stamp-vti | |
72 | -version.texi |
@@ -765,14 +765,14 @@ AC_CHECK_DECLS( | ||
765 | 765 | ) |
766 | 766 | CFLAGS="${old_CFLAGS}" |
767 | 767 | |
768 | -tme_host_types="tun bsd openvpn posix gtk" | |
768 | +tme_host_types="tun bsd openvpn posix gtk rfb" | |
769 | 769 | |
770 | 770 | for tme_host_type in ${tme_host_types}; do |
771 | 771 | eval enable_${tme_host_type}=no |
772 | 772 | done |
773 | 773 | |
774 | 774 | AC_ARG_ENABLE(hosts, |
775 | -[ --enable-hosts=hosttypes enable hosts (default="tun bsd openvpn posix gtk" if host supports)], | |
775 | +[ --enable-hosts=hosttypes enable hosts (default="tun bsd openvpn posix gtk rfb" if host supports)], | |
776 | 776 | [tme_host_types=${enableval}], [enable_hosts=yes]) |
777 | 777 | |
778 | 778 | if test "x${enable_hosts}" = xno; then |
@@ -783,6 +783,11 @@ for tme_host_type in ${tme_host_types}; do | ||
783 | 783 | eval enable_${tme_host_type}=yes |
784 | 784 | done |
785 | 785 | |
786 | +AS_IF([test "x${enable_rfb}" = xyes], [ | |
787 | + TME_HOSTS="rfb ${TME_HOSTS}" | |
788 | + PKG_CHECK_MODULES([RFB], [libvncserver]) | |
789 | +]) | |
790 | + | |
786 | 791 | AM_CONDITIONAL([USING_OPENVPN], [test "x${enable_openvpn}" = xyes && test "x${have_tap_header}" = xyes]) |
787 | 792 | if test "x${enable_openvpn}" = xyes && test "x${have_tap_header}" = xyes; then |
788 | 793 | TME_HOSTS="openvpn ${TME_HOSTS}" |
@@ -815,12 +820,13 @@ found_BPFVERSION | ||
815 | 820 | fi]) |
816 | 821 | |
817 | 822 | if test "x${TME_HOSTS}" != x; then |
818 | - TME_HOSTS="eth ${TME_HOSTS}" | |
823 | + TME_HOSTS="${TME_HOSTS}" | |
819 | 824 | fi |
820 | 825 | |
821 | 826 | if test "x${enable_posix}" = xyes; then |
822 | 827 | TME_HOSTS="posix ${TME_HOSTS}" |
823 | 828 | fi |
829 | + | |
824 | 830 | AC_MSG_RESULT($TME_HOSTS) |
825 | 831 | |
826 | 832 | AC_SYS_POSIX_TERMIOS |
@@ -1028,7 +1034,7 @@ dnl Checks for GTK. | ||
1028 | 1034 | AM_PATH_GTK_3_0([], have_gtk=yes, have_gtk=no) |
1029 | 1035 | if test "x$have_gtk" = xyes; then |
1030 | 1036 | if test "x${enable_gtk}" = xyes; then |
1031 | - TME_HOSTS="gtk display ${TME_HOSTS}" | |
1037 | + TME_HOSTS="gtk ${TME_HOSTS}" | |
1032 | 1038 | fi |
1033 | 1039 | TME_FB_XLAT_DST="d32b32s0p32olml_r0xffff0000_g0xff00ff00_b0xff0000ff d24b32s0p32olml_r0xff0000_g0xff00_b0xff" |
1034 | 1040 | # TME_FB_XLAT_DST="d32b32s0p32olml_r0xffff0000_g0xff00ff00_b0xff0000ff d24b32s0p32olml_r0xff0000_g0xff00_b0xff d16b16s0p32olml_r0xf800_g0x07e0_b0x001f d8b8s0p32olml_r0xff_g0xff_b0xff d1b1s0p32olml_r0x1_g0x1_b0x1" |
@@ -1602,10 +1608,9 @@ AC_CONFIG_FILES([Makefile | ||
1602 | 1608 | host/Makefile |
1603 | 1609 | host/openvpn/Makefile |
1604 | 1610 | host/posix/Makefile |
1605 | - host/eth/Makefile | |
1611 | + host/rfb/Makefile | |
1606 | 1612 | host/bsd/Makefile |
1607 | 1613 | host/tun/Makefile |
1608 | - host/display/Makefile | |
1609 | 1614 | host/gtk/Makefile |
1610 | 1615 | bus/Makefile |
1611 | 1616 | bus/multibus/Makefile |
@@ -2,5 +2,27 @@ | ||
2 | 2 | # Makefile.am for The Machine Emulator host/: |
3 | 3 | |
4 | 4 | AUTOMAKE_OPTIONS = 1.4 gnu |
5 | +AM_CPPFLAGS = -I$(top_srcdir) -I$(srcdir) -I$(top_srcdir)/lib -I. -D_TME_IMPL $(GTK_CFLAGS) | |
6 | + | |
7 | +lib_LTLIBRARIES = libtme-host.la | |
8 | +libtme_host_la_SOURCES = eth-impl.c eth-if.h display-mouse.c display-keyboard.c display.c display.h | |
9 | +libtme_host_la_LIBADD = $(top_builddir)/generic/libtme-generic.la $(GTK_LIBS) | |
10 | + | |
11 | +EXTRA_DIST = keymap-make.pl keymap-def.h | |
12 | + | |
13 | +display-keyboard.lo: keymap.h | |
14 | + | |
15 | +BUILT_SOURCES = keymap.h | |
16 | +CLEANFILES = keymap.h | |
17 | +if USING_X | |
18 | +keymap.h: keymap-make.pl | |
19 | + $(PERL) $< > $@ | |
20 | +else | |
21 | +keymap.h: keymap-def.h | |
22 | + cp $< $@ | |
23 | +endif | |
24 | + | |
25 | +include $(top_srcdir)/modules | |
26 | + | |
5 | 27 | SUBDIRS = @TME_HOSTS@ |
6 | -DIST_SUBDIRS = posix display gtk eth bsd tun openvpn | |
28 | +DIST_SUBDIRS = posix gtk bsd tun openvpn rfb |
@@ -3,14 +3,14 @@ | ||
3 | 3 | |
4 | 4 | AUTOMAKE_OPTIONS = 1.4 gnu |
5 | 5 | |
6 | -AM_CPPFLAGS = -I$(top_srcdir) -I$(srcdir) -I$(top_srcdir)/lib -I$(srcdir)/../eth -I. -D_TME_IMPL | |
6 | +AM_CPPFLAGS = -I$(top_srcdir) -I$(srcdir) -I$(top_srcdir)/lib -I$(srcdir)/.. -I. -D_TME_IMPL | |
7 | 7 | |
8 | 8 | pkglib_LTLIBRARIES = tme_host_bsd.la |
9 | 9 | tme_host_bsd_la_SOURCES = bsd-bpf.c |
10 | 10 | tme_host_bsd_la_LDFLAGS = -module -version-info 0:0:0 |
11 | -tme_host_bsd_la_LIBADD = ../eth/libeth.la | |
11 | +tme_host_bsd_la_LIBADD = ../libtme-host.la | |
12 | 12 | include $(top_srcdir)/modules |
13 | -$(pkglib_LTLIBRARIES): ../eth/libeth.la | |
14 | -../eth/libeth.la: force | |
13 | +$(pkglib_LTLIBRARIES): ../libtme-host.la | |
14 | +../libtme-host.la: force | |
15 | 15 | cd `dirname $@` && $(MAKE) `basename $@` |
16 | 16 | force: ; |
@@ -463,7 +463,7 @@ _tme_keyboard_ctrl(struct tme_keyboard_connection *conn_keyboard, | ||
463 | 463 | |
464 | 464 | /* ring the bell: */ |
465 | 465 | if (ctrl & TME_KEYBOARD_CTRL_BELL) { |
466 | - gdk_beep(); | |
466 | + display->tme_display_bell(display); | |
467 | 467 | } |
468 | 468 | |
469 | 469 | return (TME_OK); |
@@ -40,7 +40,7 @@ | ||
40 | 40 | #include <tme/generic/fb.h> |
41 | 41 | #include <tme/generic/keyboard.h> |
42 | 42 | #include <tme/generic/mouse.h> |
43 | -#define TME_THREADS_GLIB | |
43 | +#define TME_THREADS_POSIX | |
44 | 44 | #include <tme/threads.h> |
45 | 45 | #include <tme/hash.h> |
46 | 46 |
@@ -160,8 +160,9 @@ struct tme_display { | ||
160 | 160 | int tme_screen_height; |
161 | 161 | |
162 | 162 | /* implementation-specific callback functions: */ |
163 | - struct tme_screen *(*tme_screen_add) _TME_P((struct tme_display *, struct tme_connection *)); | |
163 | + int (*tme_display_bell) _TME_P((struct tme_display *)); | |
164 | 164 | int (*tme_display_update) _TME_P((struct tme_display *)); |
165 | + struct tme_screen *(*tme_screen_add) _TME_P((struct tme_display *, struct tme_connection *)); | |
165 | 166 | int (*tme_screen_resize) _TME_P((struct tme_screen *)); |
166 | 167 | int (*tme_screen_redraw) _TME_P((struct tme_screen *)); |
167 | 168 | int (*tme_screen_update) _TME_P((struct tme_screen *)); |
@@ -3,15 +3,15 @@ | ||
3 | 3 | |
4 | 4 | AUTOMAKE_OPTIONS = 1.4 gnu |
5 | 5 | |
6 | -AM_CPPFLAGS = -I$(top_srcdir) -I$(srcdir) -I$(top_srcdir)/lib -I$(srcdir)/../display -I. -D_TME_IMPL $(GTK_CFLAGS) | |
6 | +AM_CPPFLAGS = -I$(top_srcdir) -I$(srcdir) -I$(top_srcdir)/lib -I$(srcdir)/.. -I. -D_TME_IMPL $(GTK_CFLAGS) | |
7 | 7 | |
8 | 8 | pkglib_LTLIBRARIES = tme_host_gtk.la |
9 | 9 | tme_host_gtk_la_SOURCES = gtk-mouse.c gtk-keyboard.c gtk-screen.c gtk-display.h |
10 | 10 | tme_host_gtk_la_LDFLAGS = -module -version-info 0:0:0 |
11 | -tme_host_gtk_la_LIBADD = ../display/libdisplay.la $(GTK_LIBS) | |
11 | +tme_host_gtk_la_LIBADD = ../libtme-host.la | |
12 | 12 | |
13 | 13 | include $(top_srcdir)/modules |
14 | -$(pkglib_LTLIBRARIES): ../display/libdisplay.la | |
15 | -../display/libdisplay.la: force | |
14 | +$(pkglib_LTLIBRARIES): ../libtme-host.la | |
15 | +../libtme-host.la: force | |
16 | 16 | cd `dirname $@` && $(MAKE) `basename $@` |
17 | 17 | force: ; |
@@ -40,13 +40,9 @@ _TME_RCSID("$Id: gtk-screen.c,v 1.11 2009/08/30 21:39:03 fredette Exp $"); | ||
40 | 40 | #include "gtk-display.h" |
41 | 41 | #include <stdlib.h> |
42 | 42 | |
43 | -/* this is called before the screen's display is updated: */ | |
44 | 43 | static void |
45 | -_tme_gtk_screen_redraw(struct tme_gtk_screen *screen) | |
46 | -{ | |
47 | - cairo_surface_flush(screen->tme_gtk_screen_surface); | |
48 | - cairo_surface_mark_dirty(screen->tme_gtk_screen_surface); | |
49 | - gtk_widget_queue_draw(screen->tme_gtk_screen_gtkframe); | |
44 | +_tme_gtk_display_bell(struct tme_gdk_display *display) { | |
45 | + gdk_display_bell(display->tme_gdk_display); | |
50 | 46 | } |
51 | 47 | |
52 | 48 | static int |
@@ -319,6 +315,15 @@ _tme_gtk_screen_configure(GtkWidget *widget, | ||
319 | 315 | return TRUE; |
320 | 316 | } |
321 | 317 | |
318 | +/* this is called before the screen's display is updated: */ | |
319 | +static void | |
320 | +_tme_gtk_screen_redraw(struct tme_gtk_screen *screen) | |
321 | +{ | |
322 | + cairo_surface_flush(screen->tme_gtk_screen_surface); | |
323 | + cairo_surface_mark_dirty(screen->tme_gtk_screen_surface); | |
324 | + gtk_widget_queue_draw(screen->tme_gtk_screen_gtkframe); | |
325 | +} | |
326 | + | |
322 | 327 | /* Redraw the screen from the surface. Note that the ::draw |
323 | 328 | * signal receives a ready-to-be-used cairo_t that is already |
324 | 329 | * clipped to only draw the exposed areas of the widget |
@@ -356,7 +361,6 @@ _tme_gtk_screen_new(struct tme_gdk_display *display, | ||
356 | 361 | struct tme_gtk_screen *screen; |
357 | 362 | GdkDisplay *gdkdisplay; |
358 | 363 | GdkDeviceManager *devices; |
359 | - GdkRectangle workarea; | |
360 | 364 | GtkWidget *menu_bar; |
361 | 365 | GtkWidget *menu; |
362 | 366 | GtkWidget *submenu; |
@@ -368,19 +372,6 @@ _tme_gtk_screen_new(struct tme_gdk_display *display, | ||
368 | 372 | |
369 | 373 | screen = tme_screen_new(display, struct tme_gtk_screen, conn); |
370 | 374 | |
371 | - display->tme_gdk_display = gdk_display_get_default(); | |
372 | - | |
373 | - display->tme_gdk_display_cursor | |
374 | - = gdk_cursor_new_for_display(display->tme_gdk_display, GDK_BLANK_CURSOR); | |
375 | - | |
376 | - display->tme_gdk_display_seat = gdk_display_get_default_seat(display->tme_gdk_display); | |
377 | - | |
378 | - display->tme_gdk_display_monitor = gdk_display_get_primary_monitor(display->tme_gdk_display); | |
379 | - | |
380 | - gdk_monitor_get_workarea(display->tme_gdk_display_monitor, &workarea); | |
381 | - | |
382 | - display->display.tme_screen_width = workarea.width; | |
383 | - display->display.tme_screen_height = workarea.height; | |
384 | 375 | screen->screen.tme_screen_scale = gdk_monitor_get_scale_factor(display->tme_gdk_display_monitor); |
385 | 376 | |
386 | 377 | /* create the top-level window, and allow it to shrink, grow, |
@@ -547,7 +538,8 @@ _tme_display_menu_radio(struct tme_gtk_screen *screen, | ||
547 | 538 | |
548 | 539 | /* the new GTK display function: */ |
549 | 540 | TME_ELEMENT_SUB_NEW_DECL(tme_host_gtk,display) { |
550 | - struct tme_display *display; | |
541 | + struct tme_gdk_display *display; | |
542 | + GdkRectangle workarea; | |
551 | 543 | |
552 | 544 | /* start our data structure: */ |
553 | 545 | display = tme_new0(struct tme_gdk_display, 1); |
@@ -558,11 +550,26 @@ TME_ELEMENT_SUB_NEW_DECL(tme_host_gtk,display) { | ||
558 | 550 | |
559 | 551 | _tme_gtk_init(); |
560 | 552 | |
553 | + display->tme_gdk_display = gdk_display_get_default(); | |
554 | + | |
555 | + display->tme_gdk_display_cursor | |
556 | + = gdk_cursor_new_for_display(display->tme_gdk_display, GDK_BLANK_CURSOR); | |
557 | + | |
558 | + display->tme_gdk_display_seat = gdk_display_get_default_seat(display->tme_gdk_display); | |
559 | + | |
560 | + display->tme_gdk_display_monitor = gdk_display_get_primary_monitor(display->tme_gdk_display); | |
561 | + | |
562 | + gdk_monitor_get_workarea(display->tme_gdk_display_monitor, &workarea); | |
563 | + | |
564 | + display->display.tme_screen_width = workarea.width; | |
565 | + display->display.tme_screen_height = workarea.height; | |
566 | + | |
561 | 567 | /* set the display-specific functions: */ |
562 | - display->tme_screen_add = _tme_gtk_screen_new; | |
563 | - display->tme_screen_resize = _tme_gtk_screen_resize; | |
564 | - display->tme_screen_redraw = _tme_gtk_screen_redraw; | |
565 | - display->tme_display_update = _tme_gtk_display_update; | |
568 | + display->display.tme_display_bell = _tme_gtk_display_bell; | |
569 | + display->display.tme_display_update = _tme_gtk_display_update; | |
570 | + display->display.tme_screen_add = _tme_gtk_screen_new; | |
571 | + display->display.tme_screen_resize = _tme_gtk_screen_resize; | |
572 | + display->display.tme_screen_redraw = _tme_gtk_screen_redraw; | |
566 | 573 | |
567 | 574 | /* setup the thread loop function: */ |
568 | 575 | //tme_threads_init(NULL, gtk_main); |
@@ -3,18 +3,18 @@ | ||
3 | 3 | |
4 | 4 | AUTOMAKE_OPTIONS = 1.4 gnu |
5 | 5 | |
6 | -AM_CPPFLAGS = -I$(top_srcdir) -I$(srcdir) -I$(top_srcdir)/lib -I$(srcdir)/../eth -I. -D_TME_IMPL | |
6 | +AM_CPPFLAGS = -I$(top_srcdir) -I$(srcdir) -I$(top_srcdir)/lib -I$(srcdir)/.. -I. -D_TME_IMPL | |
7 | 7 | |
8 | 8 | pkglib_LTLIBRARIES = tme_host_openvpn.la |
9 | 9 | tme_host_openvpn_la_SOURCES = \ |
10 | 10 | openvpn-link.c \ |
11 | 11 | openvpn-tap.c |
12 | -tme_host_openvpn_la_LIBADD = ../eth/libeth.la | |
12 | +tme_host_openvpn_la_LIBADD = ../libtme-host.la | |
13 | 13 | tme_host_openvpn_la_LDFLAGS = -module -version-info 0:0:0 |
14 | 14 | |
15 | 15 | include $(top_srcdir)/modules |
16 | 16 | |
17 | -$(pkglib_LTLIBRARIES): ../eth/libeth.la | |
18 | -../eth/libeth.la: force | |
17 | +$(pkglib_LTLIBRARIES): ../libtme-host.la | |
18 | +../libtme-host.la: force | |
19 | 19 | cd `dirname $@` && $(MAKE) `basename $@` |
20 | 20 | force: ; |
@@ -3,15 +3,15 @@ | ||
3 | 3 | |
4 | 4 | AUTOMAKE_OPTIONS = 1.4 gnu |
5 | 5 | |
6 | -AM_CPPFLAGS = -I$(top_srcdir) -I$(srcdir) -I$(top_srcdir)/lib -I$(srcdir)/../display -I. -D_TME_IMPL $(RFB_CFLAGS) | |
6 | +AM_CPPFLAGS = -I$(top_srcdir) -I$(srcdir) -I$(top_srcdir)/lib -I$(srcdir)/.. -I. -D_TME_IMPL $(RFB_CFLAGS) | |
7 | 7 | |
8 | 8 | pkglib_LTLIBRARIES = tme_host_rfb.la |
9 | -tme_host_rfb_la_SOURCES = rfb-display.c rfb-display.h | |
9 | +tme_host_rfb_la_SOURCES = rfb-display.c | |
10 | 10 | tme_host_rfb_la_LDFLAGS = -module -version-info 0:0:0 |
11 | -tme_host_rfb_la_LIBADD = ../display/libdisplay.la $(RFB_LIBS) | |
11 | +tme_host_rfb_la_LIBADD = ../libtme-host.la $(RFB_LIBS) | |
12 | 12 | |
13 | 13 | include $(top_srcdir)/modules |
14 | -$(pkglib_LTLIBRARIES): ../display/libdisplay.la | |
15 | -../display/libdisplay.la: force | |
14 | +$(pkglib_LTLIBRARIES): ../libtme-host.la | |
15 | +../libtme-host.la: force | |
16 | 16 | cd `dirname $@` && $(MAKE) `basename $@` |
17 | 17 | force: ; |
@@ -36,15 +36,27 @@ | ||
36 | 36 | #include <tme/common.h> |
37 | 37 | |
38 | 38 | /* includes: */ |
39 | -#include "rfb-display.h" | |
39 | +#include "display.h" | |
40 | +#include <rfb/rfb.h> | |
40 | 41 | #include <stdlib.h> |
41 | 42 | |
43 | +static const int bpp=4; | |
44 | +static int maxx=800, maxy=600; | |
45 | +/* TODO: odd maxx doesn't work (vncviewer bug) */ | |
46 | + | |
42 | 47 | typedef struct tme_rfb_screen { |
43 | 48 | int tme_rfb_screen_mouse_buttons_last, |
44 | 49 | tme_rfb_screen_mouse_warp_x, |
45 | 50 | tme_rfb_screen_mouse_warp_y; |
46 | 51 | } tme_rfb_screen; |
47 | 52 | |
53 | +typedef struct tme_rfb_display { | |
54 | + /* the generic display structure */ | |
55 | + struct tme_display display; | |
56 | + | |
57 | + rfbScreenInfoPtr server; | |
58 | +} tme_rfb_display; | |
59 | + | |
48 | 60 | static void _tme_rfb_clientgone(rfbClientPtr cl) |
49 | 61 | { |
50 | 62 | free(cl->clientData); |
@@ -58,6 +70,11 @@ static enum rfbNewClientAction _tme_rfb_newclient(rfbClientPtr cl) | ||
58 | 70 | return RFB_CLIENT_ACCEPT; |
59 | 71 | } |
60 | 72 | |
73 | +static void | |
74 | +_tme_rfb_display_bell(struct tme_rfb_display *display) { | |
75 | + rfbSendBell(display->server); | |
76 | +} | |
77 | + | |
61 | 78 | static int |
62 | 79 | _tme_rfb_display_update(struct tme_display *display) { |
63 | 80 | long usec; |
@@ -77,83 +94,66 @@ _tme_rfb_screen_redraw(struct tme_screen *screen) | ||
77 | 94 | struct tme_fb_connection *conn_fb = screen->tme_screen_fb; |
78 | 95 | rfbScreenInfoPtr server = ((tme_rfb_display *)screen->tme_screen_display)->server; |
79 | 96 | |
80 | - if(conn_fb->tme_fb_connection_buffer == server->frameBuffer) | |
97 | + if((char *)conn_fb->tme_fb_connection_buffer == server->frameBuffer) | |
81 | 98 | rfbMarkRectAsModified(server, 0, 0, |
82 | 99 | conn_fb->tme_fb_connection_width, |
83 | 100 | conn_fb->tme_fb_connection_height); |
84 | 101 | } |
85 | 102 | |
86 | 103 | /* switch to new framebuffer contents */ |
87 | -static void _tme_rfb_screen_resize(struct tme_screen *screen, int width, int height) | |
104 | +static void _tme_rfb_screen_resize(struct tme_screen *screen) | |
88 | 105 | { |
89 | 106 | unsigned char *oldfb, *newfb; |
90 | 107 | struct tme_fb_connection *conn_fb = screen->tme_screen_fb; |
108 | + int width = conn_fb->tme_fb_connection_width; | |
109 | + int height = conn_fb->tme_fb_connection_height; | |
91 | 110 | rfbScreenInfoPtr server = ((tme_rfb_display *)screen->tme_screen_display)->server; |
92 | 111 | |
93 | 112 | newfb = (unsigned char*)tme_malloc(width * height * bpp); |
94 | - if(!conn_fb->tme_fb_connection_buffer || | |
95 | - conn_fb->tme_fb_connection_buffer == server->frameBuffer) { | |
96 | - oldfb = (unsigned char*)server->frameBuffer; | |
113 | + if((char *)conn_fb->tme_fb_connection_buffer == server->frameBuffer) { | |
97 | 114 | rfbNewFramebuffer(server, (char*)newfb, width, height, 8, 3, bpp); |
98 | - free(oldfb); | |
99 | - } else | |
100 | - free(conn_fb->tme_fb_connection_buffer); | |
115 | + } | |
116 | + free(conn_fb->tme_fb_connection_buffer); | |
101 | 117 | conn_fb->tme_fb_connection_buffer = newfb; |
102 | 118 | /*** FIXME: Re-install cursor. ***/ |
103 | 119 | } |
104 | 120 | |
105 | -/* Create a new surface of the appropriate size to store our scribbles */ | |
106 | -static gboolean | |
107 | -_tme_rfb_screen_configure(RfbWidget *widget, | |
108 | - GdkEventConfigure *event, | |
109 | - gpointer _screen) | |
121 | +/* this makes a new screen: */ | |
122 | +struct tme_screen * | |
123 | +_tme_rfb_screen_new(struct tme_rfb_display *display, | |
124 | + struct tme_connection *conn) | |
110 | 125 | { |
111 | - struct tme_rfb_screen *screen; | |
112 | - struct tme_display *display; | |
113 | - GdkWindow *window; | |
114 | - int scale; | |
115 | - | |
116 | - screen = (struct tme_rfb_screen *) _screen; | |
117 | - | |
118 | - /* get the display: */ | |
119 | - display = screen->screen.tme_screen_display; | |
126 | + struct tme_screen *screen; | |
127 | + struct tme_fb_connection *conn_fb; | |
120 | 128 | |
121 | 129 | /* lock our mutex: */ |
122 | - tme_mutex_lock(&display->tme_display_mutex); | |
130 | + tme_mutex_lock(&display->display.tme_display_mutex); | |
123 | 131 | |
124 | - cairo_surface_destroy(screen->tme_rfb_screen_surface); | |
132 | + screen = tme_screen_new(display, struct tme_screen, conn); | |
125 | 133 | |
126 | - window = rfb_widget_get_window(screen->tme_rfb_screen_rfbframe); | |
134 | + screen->tme_screen_scale = 1; | |
127 | 135 | |
128 | - screen->screen.tme_screen_scale = gdk_window_get_scale_factor(window); | |
129 | - | |
130 | - screen->tme_rfb_screen_surface | |
131 | - = gdk_window_create_similar_image_surface(window, | |
132 | - screen->tme_rfb_screen_format, | |
133 | - gdk_window_get_width(window) * screen->screen.tme_screen_scale, | |
134 | - gdk_window_get_height(window) * screen->screen.tme_screen_scale, | |
135 | - screen->screen.tme_screen_scale); | |
136 | - | |
137 | - conn_fb = screen->screen.tme_screen_fb; | |
136 | + conn_fb = screen->tme_screen_fb; | |
138 | 137 | |
139 | 138 | /* update our framebuffer connection: */ |
140 | 139 | conn_fb->tme_fb_connection_skipx = 0; |
141 | - conn_fb->tme_fb_connection_scanline_pad = _tme_rfb_scanline_pad(cairo_image_surface_get_stride(screen->tme_rfb_screen_surface)); | |
140 | + conn_fb->tme_fb_connection_scanline_pad = bpp; | |
142 | 141 | conn_fb->tme_fb_connection_order = TME_ENDIAN_NATIVE; |
143 | - conn_fb->tme_fb_connection_buffer = cairo_image_surface_get_data(screen->tme_rfb_screen_surface); | |
144 | - conn_fb->tme_fb_connection_buffsz = cairo_image_surface_get_stride(screen->tme_rfb_screen_surface) * conn_fb->tme_fb_connection_height; | |
145 | - conn_fb->tme_fb_connection_bits_per_pixel = 16; | |
146 | - conn_fb->tme_fb_connection_depth = 16; | |
142 | + conn_fb->tme_fb_connection_bits_per_pixel = bpp * 8; | |
143 | + conn_fb->tme_fb_connection_depth = 24; | |
147 | 144 | conn_fb->tme_fb_connection_class = TME_FB_XLAT_CLASS_COLOR; |
148 | - conn_fb->tme_fb_connection_mask_g = 0x0007e0; | |
149 | - conn_fb->tme_fb_connection_mask_b = 0x00001f; | |
150 | - conn_fb->tme_fb_connection_mask_r = 0x00f800; | |
145 | + conn_fb->tme_fb_connection_mask_g = 0x00ff00; | |
146 | + conn_fb->tme_fb_connection_mask_b = 0x0000ff; | |
147 | + conn_fb->tme_fb_connection_mask_r = 0xff0000; | |
148 | + display->server->frameBuffer = conn_fb->tme_fb_connection_buffer; | |
151 | 149 | |
150 | + _tme_screen_configure(screen); | |
151 | + | |
152 | 152 | /* unlock our mutex: */ |
153 | - tme_mutex_unlock(&display->tme_display_mutex); | |
153 | + tme_mutex_unlock(&display->display.tme_display_mutex); | |
154 | 154 | |
155 | 155 | /* We've handled the configure event, no need for further processing. */ |
156 | - return TRUE; | |
156 | + return (screen); | |
157 | 157 | } |
158 | 158 | |
159 | 159 | /* this is a VNC callback for a key press or release event: */ |
@@ -181,8 +181,6 @@ _tme_rfb_key_event(rfbBool down, rfbKeySym key, rfbClientPtr cl) | ||
181 | 181 | /* unlock the mutex: */ |
182 | 182 | tme_mutex_unlock(&display->tme_display_mutex); |
183 | 183 | |
184 | - /* don't process this event any further: */ | |
185 | - return (TRUE); | |
186 | 184 | } |
187 | 185 | |
188 | 186 | /* this is a VNC callback for a mouse event: */ |
@@ -259,7 +257,7 @@ TME_ELEMENT_SUB_NEW_DECL(tme_host_rfb,display) { | ||
259 | 257 | display = element->tme_element_private; |
260 | 258 | |
261 | 259 | /* allocate initial screen structure of the given size: */ |
262 | - server=rfbGetScreen(args, arg_i,maxx,maxy,8,3,4); | |
260 | + server=rfbGetScreen(&arg_i,args,maxx,maxy,8,3,bpp); | |
263 | 261 | if(!server) |
264 | 262 | return 1; |
265 | 263 | server->desktopName = "The Machine Emulator"; |
@@ -273,11 +271,15 @@ TME_ELEMENT_SUB_NEW_DECL(tme_host_rfb,display) { | ||
273 | 271 | rfbInitServer(server); |
274 | 272 | |
275 | 273 | display->server = server; |
274 | + display->display.tme_screen_width = maxx; | |
275 | + display->display.tme_screen_height = maxy; | |
276 | + | |
276 | 277 | /* set the display-specific functions: */ |
277 | - // display->tme_screen_add = _tme_rfb_screen_new; | |
278 | - display->tme_screen_resize = _tme_rfb_screen_resize; | |
279 | - display->tme_screen_redraw = _tme_rfb_screen_redraw; | |
280 | - display->tme_display_update = _tme_rfb_display_update; | |
278 | + display->display.tme_display_bell = _tme_rfb_display_bell; | |
279 | + display->display.tme_display_update = _tme_rfb_display_update; | |
280 | + display->display.tme_screen_add = _tme_rfb_screen_new; | |
281 | + display->display.tme_screen_resize = _tme_rfb_screen_resize; | |
282 | + display->display.tme_screen_redraw = _tme_rfb_screen_redraw; | |
281 | 283 | |
282 | 284 | return (TME_OK); |
283 | 285 | } |
@@ -1,125 +0,0 @@ | ||
1 | -/* $Id: gtk-display.h,v 1.10 2009/08/28 01:29:47 fredette Exp $ */ | |
2 | - | |
3 | -/* host/gtk/gtk-display.h - header file for GTK display support: */ | |
4 | - | |
5 | -/* | |
6 | - * Copyright (c) 2003 Matt Fredette | |
7 | - * All rights reserved. | |
8 | - * | |
9 | - * Redistribution and use in source and binary forms, with or without | |
10 | - * modification, are permitted provided that the following conditions | |
11 | - * are met: | |
12 | - * 1. Redistributions of source code must retain the above copyright | |
13 | - * notice, this list of conditions and the following disclaimer. | |
14 | - * 2. Redistributions in binary form must reproduce the above copyright | |
15 | - * notice, this list of conditions and the following disclaimer in the | |
16 | - * documentation and/or other materials provided with the distribution. | |
17 | - * 3. All advertising materials mentioning features or use of this software | |
18 | - * must display the following acknowledgement: | |
19 | - * This product includes software developed by Matt Fredette. | |
20 | - * 4. The name of the author may not be used to endorse or promote products | |
21 | - * derived from this software without specific prior written permission. | |
22 | - * | |
23 | - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
24 | - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
25 | - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
26 | - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | |
27 | - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
28 | - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
29 | - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
30 | - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
31 | - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | |
32 | - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
33 | - * POSSIBILITY OF SUCH DAMAGE. | |
34 | - */ | |
35 | - | |
36 | -#ifndef _HOST_GTK_DISPLAY_H | |
37 | -#define _HOST_GTK_DISPLAY_H | |
38 | - | |
39 | -_TME_RCSID("$Id: gtk-display.h,v 1.10 2009/08/28 01:29:47 fredette Exp $"); | |
40 | - | |
41 | -/* includes: */ | |
42 | -#include "display.h" | |
43 | -#ifndef G_ENABLE_DEBUG | |
44 | -#define G_ENABLE_DEBUG (0) | |
45 | -#endif /* !G_ENABLE_DEBUG */ | |
46 | -#include <gtk/gtk.h> | |
47 | - | |
48 | -/* macros: */ | |
49 | - | |
50 | -/* types: */ | |
51 | - | |
52 | -/* a display: */ | |
53 | -struct tme_gdk_display { | |
54 | - | |
55 | - /* the generic display structure */ | |
56 | - struct tme_display display; | |
57 | - | |
58 | - GdkDisplay *tme_gdk_display; | |
59 | - | |
60 | - GdkCursor *tme_gdk_display_cursor; | |
61 | - | |
62 | - GdkSeat *tme_gdk_display_seat; | |
63 | - | |
64 | - GdkMonitor *tme_gdk_display_monitor; | |
65 | -}; | |
66 | - | |
67 | -/* a screen: */ | |
68 | -struct tme_gtk_screen { | |
69 | - | |
70 | - /* the generic screen structure */ | |
71 | - struct tme_screen screen; | |
72 | - | |
73 | - rfbScreenInfoPtr server; | |
74 | - | |
75 | - /* the top-level window: */ | |
76 | - GtkWidget *tme_gtk_screen_window; | |
77 | - | |
78 | - /* the outer vertical packing box: */ | |
79 | - GtkWidget *tme_gtk_screen_vbox0; | |
80 | - | |
81 | - /* the GtkWidget, GdkWindow & cairo_surface for the framebuffer: */ | |
82 | - GtkWidget *tme_gtk_screen_gtkframe; | |
83 | - cairo_surface_t *tme_gtk_screen_surface; | |
84 | - cairo_format_t tme_gtk_screen_format; | |
85 | - | |
86 | - /* the mouse on label: */ | |
87 | - GtkWidget *tme_gtk_screen_mouse_label; | |
88 | - | |
89 | - /* the status bar, and the context ID: */ | |
90 | - GtkWidget *tme_gtk_screen_mouse_statusbar; | |
91 | - guint tme_gtk_screen_mouse_statusbar_cid; | |
92 | - | |
93 | - /* if GDK_VoidSymbol, mouse mode is off. otherwise, | |
94 | - mouse mode is on, and this is the keyval that will | |
95 | - turn mouse mode off: */ | |
96 | - guint tme_gtk_screen_mouse_keyval; | |
97 | - | |
98 | - /* when mouse mode is on, this is the previous events mask | |
99 | - for the framebuffer event box: */ | |
100 | - GdkEventMask tme_gtk_screen_mouse_events_old; | |
101 | - | |
102 | - /* when mouse mode is on, this is the warp center: */ | |
103 | - gint tme_gtk_screen_mouse_warp_x; | |
104 | - gint tme_gtk_screen_mouse_warp_y; | |
105 | - | |
106 | - /* when mouse mode is on, the last tme buttons state: */ | |
107 | - unsigned int tme_gtk_screen_mouse_buttons_last; | |
108 | -}; | |
109 | - | |
110 | -/* a menu item: */ | |
111 | -struct tme_display_menu_item { | |
112 | - /* the string for the menu item label: */ | |
113 | - const char *name; | |
114 | - | |
115 | - GCallback menu_func; | |
116 | -}; | |
117 | - | |
118 | -/* prototypes: */ | |
119 | -void _tme_gtk_keyboard_attach _TME_P((struct tme_gtk_screen *)); | |
120 | -void _tme_gtk_mouse_attach _TME_P((struct tme_gtk_screen *)); | |
121 | -gint _tme_display_enter_focus _TME_P((GtkWidget *, GdkEvent *, gpointer)); | |
122 | -GtkWidget *_tme_display_menu_radio _TME_P((struct tme_gtk_screen *, struct tme_display_menu_item *, int num_items)); | |
123 | - | |
124 | -#endif /* _HOST_GTK_DISPLAY_H */ | |
125 | - |
@@ -3,17 +3,16 @@ | ||
3 | 3 | |
4 | 4 | AUTOMAKE_OPTIONS = 1.4 gnu |
5 | 5 | |
6 | -AM_CPPFLAGS = -I$(top_srcdir) -I$(srcdir) -I$(srcdir)/../eth -I$(top_srcdir)/lib -I. -D_TME_IMPL -DDEV_TAP_FILENAME=@DEV_TAP_FILENAME@ $(NATINC) | |
6 | +AM_CPPFLAGS = -I$(top_srcdir) -I$(srcdir) -I$(srcdir)/.. -I$(top_srcdir)/lib -I. -D_TME_IMPL -DDEV_TAP_FILENAME=@DEV_TAP_FILENAME@ $(NATINC) | |
7 | 7 | |
8 | 8 | pkglib_LTLIBRARIES = tme_host_tun.la |
9 | 9 | tme_host_tun_la_SOURCES = tun-tap.c |
10 | 10 | tme_host_tun_la_LDFLAGS = -module -version-info 0:0:0 |
11 | -tme_host_tun_la_LIBADD = $(NATLIBS) \ | |
12 | - ../eth/libeth.la | |
11 | +tme_host_tun_la_LIBADD = ../libtme-host.la $(NATLIBS) | |
13 | 12 | |
14 | 13 | include $(top_srcdir)/modules |
15 | 14 | |
16 | -$(pkglib_LTLIBRARIES): ../eth/libeth.la | |
17 | -../eth/libeth.la: force | |
15 | +$(pkglib_LTLIBRARIES): ../libtme-host.la | |
16 | +../libtme-host.la: force | |
18 | 17 | cd `dirname $@` && $(MAKE) `basename $@` |
19 | 18 | force: ; |