• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Révisionb5d2faa81605973dc6399f2f6305c72bac356c73 (tree)
l'heure2020-09-11 12:02:59
AuteurRuben Agin <phabrics@phab...>
CommiterRuben Agin

Message de Log

New shared display code working with GTK.

Change Summary

Modification

--- a/.gitignore
+++ b/.gitignore
@@ -67,3 +67,6 @@ build*
6767 tmememory.h
6868 *.tex
6969 *.info
70+mdate-sh
71+stamp-vti
72+version.texi
--- a/contrib/tme-0.8/configure.ac
+++ b/contrib/tme-0.8/configure.ac
@@ -1030,7 +1030,8 @@ if test "x$have_gtk" = xyes; then
10301030 if test "x${enable_gtk}" = xyes; then
10311031 TME_HOSTS="gtk display ${TME_HOSTS}"
10321032 fi
1033- TME_FB_XLAT_DST="d32b32s0p32olml_r0xffff0000_g0xff00ff00_b0xff0000ff d24b32s0p32olml_r0xff0000_g0xff00_b0xff d16b16s0p32olml_r0xf800_g0x07e0_b0x001f d8b8s0p32olml_r0xff_g0xff_b0xff d1b1s0p32olml_r0x1_g0x1_b0x1"
1033+ TME_FB_XLAT_DST="d32b32s0p32olml_r0xffff0000_g0xff00ff00_b0xff0000ff d24b32s0p32olml_r0xff0000_g0xff00_b0xff"
1034+# TME_FB_XLAT_DST="d32b32s0p32olml_r0xffff0000_g0xff00ff00_b0xff0000ff d24b32s0p32olml_r0xff0000_g0xff00_b0xff d16b16s0p32olml_r0xf800_g0x07e0_b0x001f d8b8s0p32olml_r0xff_g0xff_b0xff d1b1s0p32olml_r0x1_g0x1_b0x1"
10341035 fi
10351036
10361037 # if --with-tme-host-displays is given, characterize those given displays:
--- a/contrib/tme-0.8/host/display/display.c
+++ b/contrib/tme-0.8/host/display/display.c
@@ -38,13 +38,14 @@
3838
3939 static _tme_thret
4040 _tme_screen_th_update(void *disp) {
41- struct tme_fb_connection *conn_fb;
4241 struct tme_screen *screen;
43- struct tme_display *display = (rfbScreenInfoPtr)disp;
42+ struct tme_display *display = (struct tme_display *)disp;
4443 int rc;
4544
4645 tme_thread_enter(NULL);
47-
46+#ifdef TME_THREADS_SJLJ
47+ tme_thread_create(&display->tme_display_thread, tme_sjlj_threads_main, NULL);
48+#endif
4849 //_tme_thread_suspended();
4950
5051 for(;;) {
@@ -60,18 +61,15 @@ _tme_screen_th_update(void *disp) {
6061 /* loop over all screens: */
6162 for (screen = display->tme_display_screens;
6263 screen != NULL;
63- screen = screen->tme_screen_next)
64+ screen = screen->tme_screen_next) {
6465 switch(screen->tme_screen_update) {
6566 case TME_SCREEN_UPDATE_REDRAW:
6667 if(display->tme_screen_redraw)
6768 display->tme_screen_redraw(screen);
6869 break;
6970 case TME_SCREEN_UPDATE_RESIZE:
70- if(display->tme_screen_resize &&
71- (conn_fb = screen->tme_screen_fb))
72- display->tme_screen_resize(screen,
73- conn_fb->tme_fb_connection_width,
74- conn_fb->tme_fb_connection_height);
71+ if(display->tme_screen_resize)
72+ display->tme_screen_resize(screen);
7573 break;
7674 case TME_SCREEN_UPDATE_NONE:
7775 break;
@@ -80,6 +78,8 @@ _tme_screen_th_update(void *disp) {
8078 if(display->tme_screen_update)
8179 display->tme_screen_update(screen);
8280 }
81+ screen->tme_screen_update = TME_SCREEN_UPDATE_NONE;
82+ }
8383 tme_mutex_unlock(&display->tme_display_mutex);
8484 }
8585
@@ -104,7 +104,7 @@ _tme_display_update(struct tme_display *display)
104104 /* skip this screen if it's unconnected: */
105105 if (screen->tme_screen_update != TME_SCREEN_UPDATE_NONE ||
106106 !(conn_fb = screen->tme_screen_fb) ||
107- !conn_fb->tme_fb_connection_buffer ||
107+ !conn_fb->tme_fb_connection_buffsz ||
108108 !(conn_fb_other = (struct tme_fb_connection *)conn_fb->tme_fb_connection.tme_connection_other)) return rc;
109109
110110 /* unlock the mutex: */
@@ -500,10 +500,11 @@ _tme_screen_configure(struct tme_screen *screen)
500500 /* set the size & translation function */
501501 screen->tme_screen_fb_xlat = NULL;
502502 if(conn_fb->tme_fb_connection_width != width ||
503- conn_fb->tme_fb_connection_height != height)
503+ conn_fb->tme_fb_connection_height != height) {
504504 screen->tme_screen_update = TME_SCREEN_UPDATE_RESIZE;
505505 conn_fb->tme_fb_connection_width = width;
506506 conn_fb->tme_fb_connection_height = height;
507+ conn_fb->tme_fb_connection_buffsz = 0;
507508 }
508509 }
509510
@@ -720,7 +721,7 @@ int tme_display_init(struct tme_element *element,
720721
721722 /* setup the thread loop function: */
722723 #ifdef TME_THREADS_SJLJ
723- tme_thread_create(&display->tme_display_thread, tme_sjlj_threads_main, NULL);
724+ // tme_thread_create(&display->tme_display_thread, tme_sjlj_threads_main, NULL);
724725 tme_sjlj_thread_create(&display->tme_display_sjlj_thread, _tme_display_th_update, display);
725726 #else
726727 tme_thread_create(&display->tme_display_sjlj_thread, _tme_display_th_update, display);
--- a/contrib/tme-0.8/host/display/display.h
+++ b/contrib/tme-0.8/host/display/display.h
@@ -53,6 +53,9 @@
5353 #define TME_DISPLAY_CALLOUT_KEYBOARD_CTRL TME_BIT(1)
5454 #define TME_DISPLAY_CALLOUT_MOUSE_CTRL TME_BIT(2)
5555 #define BLANK_SIDE (16 * 8)
56+#define TME_SCREEN_UPDATE_NONE (0)
57+#define TME_SCREEN_UPDATE_REDRAW (1)
58+#define TME_SCREEN_UPDATE_RESIZE (2)
5659
5760 /* types: */
5861
@@ -159,10 +162,9 @@ struct tme_display {
159162 /* implementation-specific callback functions: */
160163 struct tme_screen *(*tme_screen_add) _TME_P((struct tme_display *, struct tme_connection *));
161164 int (*tme_display_update) _TME_P((struct tme_display *));
162- int (*tme_screen_set_size) _TME_P((struct tme_screen *,
163- int,
164- int));
165-
165+ int (*tme_screen_resize) _TME_P((struct tme_screen *));
166+ int (*tme_screen_redraw) _TME_P((struct tme_screen *));
167+ int (*tme_screen_update) _TME_P((struct tme_screen *));
166168 };
167169
168170 /* prototypes: */
--- a/contrib/tme-0.8/host/gtk/gtk-screen.c
+++ b/contrib/tme-0.8/host/gtk/gtk-screen.c
@@ -51,7 +51,8 @@ _tme_gtk_screen_redraw(struct tme_gtk_screen *screen)
5151
5252 static int
5353 _tme_gtk_display_update(struct tme_display *display) {
54- gtk_main_iteration_do(FALSE);
54+ while (gtk_events_pending ())
55+ gtk_main_iteration ();
5556 return TME_OK;
5657 }
5758
@@ -194,11 +195,13 @@ static struct tme_display_menu_item format_items[] =
194195 };
195196
196197 /* Screen-specific size request */
197-static void _tme_gtk_screen_resize(struct tme_gtk_screen *screen,
198- int width,
199- int height) {
198+static void _tme_gtk_screen_resize(struct tme_gtk_screen *screen) {
199+ struct tme_fb_connection *conn_fb = screen->screen.tme_screen_fb;
200+
200201 /* set a minimum size */
201- gtk_widget_set_size_request(screen->tme_gtk_screen_gtkframe, width, height);
202+ gtk_widget_set_size_request(screen->tme_gtk_screen_gtkframe,
203+ conn_fb->tme_fb_connection_width,
204+ conn_fb->tme_fb_connection_height);
202205 }
203206
204207 /* Create a similar image surface to the screen's target surface (i.e., backing store) */
@@ -302,13 +305,13 @@ _tme_gtk_screen_configure(GtkWidget *widget,
302305 conn_fb->tme_fb_connection_order = TME_ENDIAN_NATIVE;
303306 conn_fb->tme_fb_connection_buffer = cairo_image_surface_get_data(screen->tme_gtk_screen_surface);
304307 conn_fb->tme_fb_connection_buffsz = cairo_image_surface_get_stride(screen->tme_gtk_screen_surface) * conn_fb->tme_fb_connection_height;
305- conn_fb->tme_fb_connection_bits_per_pixel = 16;
306- conn_fb->tme_fb_connection_depth = 16;
308+ conn_fb->tme_fb_connection_bits_per_pixel = 32;
309+ conn_fb->tme_fb_connection_depth = 24;
307310 conn_fb->tme_fb_connection_class = TME_FB_XLAT_CLASS_COLOR;
308- conn_fb->tme_fb_connection_mask_g = 0x0007e0;
309- conn_fb->tme_fb_connection_mask_b = 0x00001f;
310- conn_fb->tme_fb_connection_mask_r = 0x00f800;
311-
311+ conn_fb->tme_fb_connection_mask_g = 0x00ff00;
312+ conn_fb->tme_fb_connection_mask_b = 0x0000ff;
313+ conn_fb->tme_fb_connection_mask_r = 0xff0000;
314+
312315 /* unlock our mutex: */
313316 tme_mutex_unlock(&display->tme_display_mutex);
314317
@@ -338,7 +341,6 @@ _tme_gtk_screen_draw(GtkWidget *widget,
338341
339342 cairo_set_source_surface(cr, screen->tme_gtk_screen_surface, 0, 0);
340343 cairo_paint(cr);
341- screen->screen.tme_screen_update = TME_SCREEN_UPDATE_NONE;
342344
343345 /* unlock our mutex: */
344346 tme_mutex_unlock(&display->tme_display_mutex);
@@ -440,7 +442,7 @@ _tme_gtk_screen_new(struct tme_gdk_display *display,
440442 // _tme_gtk_screen_init(screen->tme_gtk_screen_gtkframe, screen);
441443
442444
443- _tme_screen_format_set(screen, CAIRO_FORMAT_RGB16_565);
445+ _tme_screen_format_set(screen, CAIRO_FORMAT_RGB24);
444446
445447 /* pack the Gtkframe into the outer vertical packing box: */
446448 gtk_box_pack_start(GTK_BOX(screen->tme_gtk_screen_vbox0),
@@ -461,6 +463,8 @@ _tme_gtk_screen_new(struct tme_gdk_display *display,
461463
462464 snprintf(title, sizeof(title), "%s (%s)", PACKAGE_STRING, conn->tme_connection_other->tme_connection_element->tme_element_args[0]);
463465 gtk_window_set_title(GTK_WINDOW(screen->tme_gtk_screen_window), title);
466+
467+ _tme_gtk_screen_resize(screen);
464468
465469 /* unlock our mutex: */
466470 tme_mutex_unlock(&display->display.tme_display_mutex);