Revision | 2f7e337032b081e4fa6874e7261c089e4c22693a (tree) |
---|---|
Time | 2023-03-01 20:55:20 |
Author | phabrics <phabrics@phab...> |
Commiter | phabrics |
Continued migration from GTK3 to GTK4 using recommended changes from GTK4 documentation.
@@ -75,6 +75,8 @@ _tme_gtk_display_update(struct tme_display *display) { | ||
75 | 75 | return !rc; |
76 | 76 | } |
77 | 77 | |
78 | +#if GTK_MAJOR_VERSION == 3 | |
79 | + | |
78 | 80 | /* this sets the screen scaling to that indicated by the Scale menu: */ |
79 | 81 | static void |
80 | 82 | _tme_gtk_screen_scale_default(GtkWidget *widget, |
@@ -119,7 +121,6 @@ _tme_gtk_screen_scale_double(GtkWidget *widget, | ||
119 | 121 | _tme_screen_scale_set(screen, TME_FB_XLAT_SCALE_DOUBLE ); |
120 | 122 | } |
121 | 123 | |
122 | -#if GTK_MAJOR_VERSION == 3 | |
123 | 124 | /* this sets the screen size: */ |
124 | 125 | static inline void |
125 | 126 | _tme_screen_format_set(_tme_gtk_screen *screen, |
@@ -193,8 +194,6 @@ static struct tme_display_menu_item format_items[] = | ||
193 | 194 | { _("RGB16_565"), G_CALLBACK(_tme_gtk_screen_format_rgb16_565) } |
194 | 195 | }; |
195 | 196 | |
196 | -#endif | |
197 | - | |
198 | 197 | static struct tme_display_menu_item scale_items[] = |
199 | 198 | { |
200 | 199 | { _("Default"), G_CALLBACK(_tme_gtk_screen_scale_default) }, |
@@ -203,12 +202,14 @@ static struct tme_display_menu_item scale_items[] = | ||
203 | 202 | { _("Double"), G_CALLBACK(_tme_gtk_screen_scale_double) } |
204 | 203 | }; |
205 | 204 | |
205 | +#endif | |
206 | + | |
206 | 207 | /* Screen-specific size request */ |
207 | 208 | static void _tme_gtk_screen_resize(_tme_gtk_screen *screen) { |
208 | 209 | struct tme_fb_connection *conn_fb = screen->screen.tme_screen_fb; |
209 | 210 | |
210 | 211 | /* set a minimum size */ |
211 | - gtk_widget_set_size_request(screen->tme_gtk_screen_gtkframe, | |
212 | + gtk_widget_set_size_request(screen->tme_gtk_screen_draw, | |
212 | 213 | conn_fb->tme_fb_connection_width, |
213 | 214 | conn_fb->tme_fb_connection_height); |
214 | 215 | } |
@@ -303,7 +304,7 @@ _tme_gtk_screen_redraw(_tme_gtk_screen *screen, int x, int y, int w, int h) | ||
303 | 304 | { |
304 | 305 | cairo_surface_flush(screen->tme_gtk_screen_surface); |
305 | 306 | cairo_surface_mark_dirty(screen->tme_gtk_screen_surface); |
306 | - gtk_widget_queue_draw(screen->tme_gtk_screen_gtkframe); | |
307 | + gtk_widget_queue_draw(screen->tme_gtk_screen_draw); | |
307 | 308 | } |
308 | 309 | |
309 | 310 | /* Redraw the screen from the surface. Note that the ::draw |
@@ -352,37 +353,56 @@ _tme_gtk_screen_new(_tme_gtk_display *display, | ||
352 | 353 | struct tme_connection *conn) |
353 | 354 | { |
354 | 355 | _tme_gtk_screen *screen; |
356 | + GtkWidget *vbox; | |
357 | +#if GTK_MAJOR_VERSION == 3 | |
355 | 358 | GtkWidget *menu_bar; |
356 | 359 | GtkWidget *menu; |
357 | 360 | GtkWidget *submenu; |
358 | 361 | GtkWidget *menu_item; |
359 | - | |
362 | +#endif | |
363 | + | |
360 | 364 | screen = tme_screen_new(display, _tme_gtk_screen, conn); |
361 | 365 | |
366 | + /* create the header bar: */ | |
367 | + screen->tme_gtk_screen_header = gtk_header_bar_new(); | |
368 | + | |
369 | + /* create the outer vertical packing box: */ | |
370 | + vbox | |
371 | + = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); | |
372 | + | |
373 | + /* create the Draw for the framebuffer area: */ | |
374 | + screen->tme_gtk_screen_draw = gtk_drawing_area_new(); | |
375 | + | |
362 | 376 | /* create the top-level window, and allow it to shrink, grow, |
363 | 377 | and auto-shrink: */ |
364 | 378 | screen->tme_gtk_screen_window = |
365 | 379 | #if GTK_MAJOR_VERSION == 4 |
366 | 380 | gtk_window_new(); |
381 | + | |
382 | + gtk_drawing_area_set_draw_func(GTK_DRAWING_AREA(screen->tme_gtk_screen_draw), | |
383 | + _tme_gtk_screen_draw, screen, NULL); | |
384 | + g_signal_connect_after(screen->tme_gtk_screen_draw, "resize", | |
385 | + G_CALLBACK(_tme_gtk_screen_configure), screen); | |
386 | + | |
387 | + /* add the outer vertical packing box to the window: */ | |
388 | + gtk_window_set_child(GTK_WINDOW(screen->tme_gtk_screen_window), vbox); | |
389 | + | |
390 | + /* pack the Draw into the outer vertical packing box: */ | |
391 | + gtk_box_prepend(GTK_BOX(vbox), | |
392 | + screen->tme_gtk_screen_draw); | |
393 | + | |
367 | 394 | #elif GTK_MAJOR_VERSION == 3 |
368 | 395 | gtk_window_new(GTK_WINDOW_TOPLEVEL); |
369 | 396 | screen->screen.tme_screen_scale = gdk_monitor_get_scale_factor(display->tme_gdk_display_monitor); |
370 | -#endif | |
371 | - | |
372 | - gtk_window_set_resizable(GTK_WINDOW(screen->tme_gtk_screen_window), FALSE); | |
373 | - | |
374 | - /* create the outer vertical packing box: */ | |
375 | - screen->tme_gtk_screen_vbox0 | |
376 | - = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); | |
377 | 397 | |
378 | 398 | /* add the outer vertical packing box to the window: */ |
379 | 399 | gtk_container_add(GTK_CONTAINER(screen->tme_gtk_screen_window), |
380 | - screen->tme_gtk_screen_vbox0); | |
400 | + vbox); | |
381 | 401 | |
382 | 402 | /* create the menu bar and pack it into the outer vertical packing |
383 | 403 | box: */ |
384 | 404 | menu_bar = gtk_menu_bar_new (); |
385 | - gtk_box_pack_start(GTK_BOX(screen->tme_gtk_screen_vbox0), | |
405 | + gtk_box_pack_start(GTK_BOX(vbox), | |
386 | 406 | menu_bar, |
387 | 407 | FALSE, FALSE, 0); |
388 | 408 | // gtk_widget_show(menu_bar); |
@@ -399,7 +419,6 @@ _tme_gtk_screen_new(_tme_gtk_display *display, | ||
399 | 419 | gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), submenu); |
400 | 420 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); |
401 | 421 | |
402 | -#if GTK_MAJOR_VERSION == 3 | |
403 | 422 | /* create the Screen colormap submenu: */ |
404 | 423 | submenu = _tme_display_menu_radio(screen, format_items, TME_ARRAY_ELS(format_items)); |
405 | 424 |
@@ -411,8 +430,6 @@ _tme_gtk_screen_new(_tme_gtk_display *display, | ||
411 | 430 | |
412 | 431 | _tme_screen_format_set(screen, CAIRO_FORMAT_RGB24); |
413 | 432 | |
414 | -#endif | |
415 | - | |
416 | 433 | /* create the Screen menu bar item, attach the menu to it, and |
417 | 434 | attach the menu bar item to the menu bar: */ |
418 | 435 | menu_item = gtk_menu_item_new_with_label("Screen"); |
@@ -420,37 +437,28 @@ _tme_gtk_screen_new(_tme_gtk_display *display, | ||
420 | 437 | gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), menu); |
421 | 438 | gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), menu_item); |
422 | 439 | |
423 | - /* create the Gtkframe for the framebuffer area: */ | |
424 | - screen->tme_gtk_screen_gtkframe = gtk_drawing_area_new(); | |
425 | - | |
426 | - /* new a minimum size */ | |
427 | - //_tme_gtk_screen_set_size(screen, BLANK_SIDE, BLANK_SIDE); | |
428 | - // _tme_gtk_screen_init(screen->tme_gtk_screen_gtkframe, screen); | |
429 | - | |
430 | - | |
431 | - /* pack the Gtkframe into the outer vertical packing box: */ | |
432 | - gtk_box_pack_start(GTK_BOX(screen->tme_gtk_screen_vbox0), | |
433 | - screen->tme_gtk_screen_gtkframe, | |
440 | + /* pack the Draw into the outer vertical packing box: */ | |
441 | + gtk_box_pack_start(GTK_BOX(vbox), | |
442 | + screen->tme_gtk_screen_draw, | |
434 | 443 | FALSE, FALSE, 0); |
435 | 444 | |
436 | -#if GTK_MAJOR_VERSION == 4 | |
437 | - gtk_drawing_area_set_draw_func(GTK_DRAWING_AREA(screen->tme_gtk_screen_gtkframe), | |
438 | - _tme_gtk_screen_draw, screen, NULL); | |
439 | - g_signal_connect_after(screen->tme_gtk_screen_gtkframe, "resize", | |
440 | - G_CALLBACK(_tme_gtk_screen_configure), screen); | |
441 | -#elif GTK_MAJOR_VERSION == 3 | |
442 | - g_signal_connect(screen->tme_gtk_screen_gtkframe, "draw", | |
445 | + g_signal_connect(screen->tme_gtk_screen_draw, "draw", | |
443 | 446 | G_CALLBACK(_tme_gtk_screen_draw), screen); |
444 | - g_signal_connect(screen->tme_gtk_screen_gtkframe, "configure-event", | |
447 | + g_signal_connect(screen->tme_gtk_screen_draw, "configure-event", | |
445 | 448 | G_CALLBACK(_tme_gtk_screen_configure), screen); |
446 | 449 | #endif |
447 | 450 | |
451 | + gtk_window_set_resizable(GTK_WINDOW(screen->tme_gtk_screen_window), FALSE); | |
452 | + | |
448 | 453 | /* attach the mouse to this screen: */ |
449 | 454 | _tme_gtk_mouse_attach(screen); |
450 | 455 | |
451 | 456 | /* attach the keyboard to this screen: */ |
452 | 457 | _tme_gtk_keyboard_attach(screen); |
453 | 458 | |
459 | + gtk_window_set_titlebar(GTK_WINDOW(screen->tme_gtk_screen_window), | |
460 | + screen->tme_gtk_screen_header); | |
461 | + | |
454 | 462 | gtk_window_set_title(GTK_WINDOW(screen->tme_gtk_screen_window), |
455 | 463 | display->display.tme_display_title); |
456 | 464 |
@@ -469,6 +477,7 @@ _tme_gtk_screen_new(_tme_gtk_display *display, | ||
469 | 477 | return (screen); |
470 | 478 | } |
471 | 479 | |
480 | +#if GTK_MAJOR_VERSION == 3 | |
472 | 481 | /* this creates a menu of radio buttons: */ |
473 | 482 | GtkWidget * |
474 | 483 | _tme_display_menu_radio(_tme_gtk_screen *screen, |
@@ -502,6 +511,7 @@ _tme_display_menu_radio(_tme_gtk_screen *screen, | ||
502 | 511 | /* return the menu: */ |
503 | 512 | return (menu); |
504 | 513 | } |
514 | +#endif | |
505 | 515 | |
506 | 516 | /* the new GTK display function: */ |
507 | 517 | TME_ELEMENT_SUB_NEW_DECL(tme_host_gtk,display) { |
@@ -51,12 +51,12 @@ _TME_RCSID("$Id: gtk-display.h,v 1.10 2009/08/28 01:29:47 fredette Exp $"); | ||
51 | 51 | |
52 | 52 | /* a display: */ |
53 | 53 | typedef struct tme_gtk_display { |
54 | - /* the GTK application structure */ | |
55 | - GtkApplication *tme_gtk_application; | |
56 | - | |
57 | 54 | /* the generic display structure */ |
58 | 55 | struct tme_display display; |
59 | 56 | |
57 | + /* the GTK application structure */ | |
58 | + GtkApplication *tme_gtk_application; | |
59 | + | |
60 | 60 | GdkDisplay *tme_gdk_display; |
61 | 61 | |
62 | 62 | GdkCursor *tme_gdk_display_cursor; |
@@ -77,26 +77,30 @@ typedef struct tme_gtk_screen { | ||
77 | 77 | /* the top-level window: */ |
78 | 78 | GtkWidget *tme_gtk_screen_window; |
79 | 79 | |
80 | - /* the outer vertical packing box: */ | |
81 | - GtkWidget *tme_gtk_screen_vbox0; | |
80 | + /* the header bar: */ | |
81 | + GtkWidget *tme_gtk_screen_header; | |
82 | 82 | |
83 | - /* the GtkWidget, GdkWindow & cairo_surface for the framebuffer: */ | |
84 | - GtkWidget *tme_gtk_screen_gtkframe; | |
83 | + /* the drawing area & surface for the framebuffer: */ | |
84 | + GtkWidget *tme_gtk_screen_draw; | |
85 | 85 | cairo_surface_t *tme_gtk_screen_surface; |
86 | - cairo_format_t tme_gtk_screen_format; | |
87 | 86 | |
88 | 87 | /* the mouse on label: */ |
89 | 88 | GtkWidget *tme_gtk_screen_mouse_label; |
90 | 89 | |
91 | - /* the status bar, and the context ID: */ | |
92 | - GtkWidget *tme_gtk_screen_mouse_statusbar; | |
93 | - guint tme_gtk_screen_mouse_statusbar_cid; | |
94 | - | |
95 | 90 | /* if GDK_VoidSymbol, mouse mode is off. otherwise, |
96 | 91 | mouse mode is on, and this is the keyval that will |
97 | 92 | turn mouse mode off: */ |
98 | 93 | guint tme_gtk_screen_mouse_keyval; |
99 | 94 | |
95 | +#if GTK_MAJOR_VERSION == 3 | |
96 | + /* the status bar, and the context ID: */ | |
97 | + GtkWidget *tme_gtk_screen_mouse_statusbar; | |
98 | + guint tme_gtk_screen_mouse_statusbar_cid; | |
99 | + | |
100 | + cairo_format_t tme_gtk_screen_format; | |
101 | + GtkEventControllerKey *key; | |
102 | + GtkEventControllerMotion *motion; | |
103 | + | |
100 | 104 | /* when mouse mode is on, this is the previous events mask |
101 | 105 | for the framebuffer event box: */ |
102 | 106 | //GdkEventMask tme_gtk_screen_mouse_events_old; |
@@ -112,9 +116,12 @@ struct tme_display_menu_item { | ||
112 | 116 | }; |
113 | 117 | |
114 | 118 | /* prototypes: */ |
119 | +GtkWidget *_tme_display_menu_radio _TME_P((struct tme_gtk_screen *, struct tme_display_menu_item *, int num_items)); | |
120 | +#else | |
121 | +} _tme_gtk_screen, *tme_gtk_screen; | |
122 | +#endif | |
115 | 123 | void _tme_gtk_keyboard_attach _TME_P((struct tme_gtk_screen *)); |
116 | 124 | void _tme_gtk_mouse_attach _TME_P((struct tme_gtk_screen *)); |
117 | -GtkWidget *_tme_display_menu_radio _TME_P((struct tme_gtk_screen *, struct tme_display_menu_item *, int num_items)); | |
118 | 125 | |
119 | 126 | #endif /* _HOST_GTK_DISPLAY_H */ |
120 | 127 |
@@ -73,19 +73,21 @@ _tme_gtk_keyboard_attach(struct tme_gtk_screen *screen) | ||
73 | 73 | GtkEventControllerKey *key; |
74 | 74 | GtkEventControllerMotion *motion; |
75 | 75 | |
76 | - motion=gtk_event_controller_motion_new(screen->tme_gtk_screen_gtkframe); | |
77 | - gtk_widget_add_controller(screen->tme_gtk_screen_gtkframe, GTK_EVENT_CONTROLLER(motion)); | |
76 | +#if GTK_MAJOR_VERSION == 4 | |
77 | + motion=gtk_event_controller_motion_new(); | |
78 | + key=gtk_event_controller_key_new(); | |
79 | + gtk_widget_add_controller(screen->tme_gtk_screen_draw, GTK_EVENT_CONTROLLER(key)); | |
80 | + gtk_widget_add_controller(screen->tme_gtk_screen_draw, GTK_EVENT_CONTROLLER(motion)); | |
81 | +#elif GTK_MAJOR_VERSION == 3 | |
82 | + motion=screen->motion=gtk_event_controller_motion_new(screen->tme_gtk_screen_draw); | |
83 | + key=screen->key=gtk_event_controller_key_new(screen->tme_gtk_screen_draw); | |
84 | +#endif | |
78 | 85 | |
79 | 86 | /* on entering window, grab keyboard focus: */ |
80 | 87 | g_signal_connect_swapped(motion, |
81 | 88 | "enter", |
82 | 89 | G_CALLBACK(gtk_widget_grab_focus), |
83 | - screen->tme_gtk_screen_gtkframe); | |
84 | - | |
85 | - /* set the signal handler for the key events: */ | |
86 | - key=gtk_event_controller_key_new(screen->tme_gtk_screen_gtkframe); | |
87 | - | |
88 | - gtk_widget_add_controller(screen->tme_gtk_screen_gtkframe, GTK_EVENT_CONTROLLER(key)); | |
90 | + screen->tme_gtk_screen_draw); | |
89 | 91 | |
90 | 92 | g_signal_connect_after(key, |
91 | 93 | "key-pressed", |
@@ -97,8 +99,8 @@ _tme_gtk_keyboard_attach(struct tme_gtk_screen *screen) | ||
97 | 99 | screen->screen.tme_screen_display); |
98 | 100 | |
99 | 101 | /* the event box can focus, and have it grab the focus now: */ |
100 | - gtk_widget_set_can_focus(screen->tme_gtk_screen_gtkframe, TRUE); | |
101 | - gtk_widget_grab_focus(screen->tme_gtk_screen_gtkframe); | |
102 | + gtk_widget_set_can_focus(screen->tme_gtk_screen_draw, TRUE); | |
103 | + gtk_widget_grab_focus(screen->tme_gtk_screen_draw); | |
102 | 104 | |
103 | 105 | } |
104 | 106 |
@@ -41,7 +41,7 @@ _TME_RCSID("$Id: gtk-mouse.c,v 1.3 2007/03/03 15:33:22 fredette Exp $"); | ||
41 | 41 | #include <gdk/gdkkeysyms.h> |
42 | 42 | |
43 | 43 | #if 0 |
44 | -/* this warps the pointer to the middle of the Gtkframe: */ | |
44 | +/* this warps the pointer to the middle of the Draw: */ | |
45 | 45 | void |
46 | 46 | _tme_gtk_mouse_warp_pointer(struct tme_gtk_screen *screen) |
47 | 47 | { |
@@ -164,22 +164,22 @@ _tme_gtk_mouse_ebox_event(GtkWidget *widget, | ||
164 | 164 | status); |
165 | 165 | tme_free(status); |
166 | 166 | |
167 | - window = gtk_widget_get_window(screen->tme_gtk_screen_gtkframe); | |
167 | + window = gtk_widget_get_window(screen->tme_gtk_screen_draw); | |
168 | 168 | |
169 | 169 | /* if the original events mask on the framebuffer event box have |
170 | 170 | never been saved, save them now, and add the mouse events: */ |
171 | 171 | /* if (screen->tme_gtk_screen_mouse_events_old == 0) { |
172 | 172 | screen->tme_gtk_screen_mouse_events_old |
173 | - = gtk_widget_get_events(screen->tme_gtk_screen_gtkframe); | |
174 | - gtk_widget_add_events(screen->tme_gtk_screen_gtkframe, | |
173 | + = gtk_widget_get_events(screen->tme_gtk_screen_draw); | |
174 | + gtk_widget_add_events(screen->tme_gtk_screen_draw, | |
175 | 175 | GDK_POINTER_MOTION_MASK |
176 | 176 | | GDK_BUTTON_PRESS_MASK |
177 | 177 | | GDK_BUTTON_RELEASE_MASK); |
178 | 178 | } |
179 | 179 | */ |
180 | 180 | /* grab the pointer: */ |
181 | - gtk_grab_add(screen->tme_gtk_screen_gtkframe); | |
182 | - /*gtk_device_grab_add(screen->tme_gtk_screen_gtkframe, | |
181 | + gtk_grab_add(screen->tme_gtk_screen_draw); | |
182 | + /*gtk_device_grab_add(screen->tme_gtk_screen_draw, | |
183 | 183 | gdk_seat_get_pointer(display->tme_gdk_display_seat), |
184 | 184 | FALSE);*/ |
185 | 185 |
@@ -226,11 +226,11 @@ _tme_gtk_mouse_mode_off(struct tme_gtk_screen *screen, | ||
226 | 226 | |
227 | 227 | /* ungrab the pointer: */ |
228 | 228 | gdk_seat_ungrab(display->tme_gdk_display_seat); |
229 | - gtk_grab_remove(screen->tme_gtk_screen_gtkframe); | |
230 | - //gtk_device_grab_remove(screen->tme_gtk_screen_gtkframe, gdk_seat_get_pointer(display->tme_gdk_display_seat)); | |
229 | + gtk_grab_remove(screen->tme_gtk_screen_draw); | |
230 | + //gtk_device_grab_remove(screen->tme_gtk_screen_draw, gdk_seat_get_pointer(display->tme_gdk_display_seat)); | |
231 | 231 | |
232 | 232 | /* restore the old events mask on the event box: */ |
233 | - // gtk_widget_set_events(screen->tme_gtk_screen_gtkframe, screen->tme_gtk_screen_mouse_events_old); | |
233 | + // gtk_widget_set_events(screen->tme_gtk_screen_draw, screen->tme_gtk_screen_mouse_events_old); | |
234 | 234 | |
235 | 235 | /* pop our message off of the statusbar: */ |
236 | 236 | gtk_statusbar_pop(GTK_STATUSBAR(screen->tme_gtk_screen_mouse_statusbar), |
@@ -248,27 +248,13 @@ _tme_gtk_mouse_mode_off(struct tme_gtk_screen *screen, | ||
248 | 248 | void |
249 | 249 | _tme_gtk_mouse_attach(struct tme_gtk_screen *screen) |
250 | 250 | { |
251 | - GtkWidget *hbox0; | |
252 | 251 | GtkWidget *ebox; |
253 | 252 | |
254 | - /* create the horizontal packing box for the mouse controls: */ | |
255 | - hbox0 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); | |
256 | - | |
257 | - /* pack the horizontal packing box into the outer vertical packing box: */ | |
258 | - gtk_box_pack_start(GTK_BOX(screen->tme_gtk_screen_vbox0), | |
259 | - hbox0, | |
260 | - FALSE, FALSE, 0); | |
261 | - | |
262 | - /* show the horizontal packing box: */ | |
263 | - gtk_widget_show(hbox0); | |
264 | - | |
265 | 253 | /* create the event box for the mouse on label: */ |
266 | 254 | ebox = gtk_event_box_new(); |
267 | - | |
255 | + | |
268 | 256 | /* pack the event box into the horizontal packing box: */ |
269 | - gtk_box_pack_start(GTK_BOX(hbox0), | |
270 | - ebox, | |
271 | - FALSE, FALSE, 0); | |
257 | + gtk_header_bar_pack_start(GTK_HEADER_BAR(screen->tme_gtk_screen_header), ebox); | |
272 | 258 | |
273 | 259 | /* set the tip on the event box, which will eventually contain the mouse on label: */ |
274 | 260 | gtk_widget_set_tooltip_text(ebox, |
@@ -288,9 +274,6 @@ _tme_gtk_mouse_attach(struct tme_gtk_screen *screen) | ||
288 | 274 | /* the event box can focus: */ |
289 | 275 | gtk_widget_set_can_focus(ebox, TRUE); |
290 | 276 | |
291 | - /* show the event box: */ | |
292 | - gtk_widget_show(ebox); | |
293 | - | |
294 | 277 | /* create the mouse on label: */ |
295 | 278 | screen->tme_gtk_screen_mouse_label |
296 | 279 | = gtk_label_new(_("Mouse is off")); |
@@ -299,20 +282,13 @@ _tme_gtk_mouse_attach(struct tme_gtk_screen *screen) | ||
299 | 282 | gtk_container_add(GTK_CONTAINER(ebox), |
300 | 283 | screen->tme_gtk_screen_mouse_label); |
301 | 284 | |
302 | - /* show the mouse on label: */ | |
303 | - gtk_widget_show(screen->tme_gtk_screen_mouse_label); | |
304 | - | |
305 | 285 | /* create the mouse statusbar: */ |
306 | 286 | screen->tme_gtk_screen_mouse_statusbar |
307 | 287 | = gtk_statusbar_new(); |
308 | 288 | |
309 | 289 | /* pack the mouse statusbar into the horizontal packing box: */ |
310 | - gtk_box_pack_start(GTK_BOX(hbox0), | |
311 | - screen->tme_gtk_screen_mouse_statusbar, | |
312 | - TRUE, TRUE, 10); | |
313 | - | |
314 | - /* show the mouse statusbar: */ | |
315 | - gtk_widget_show(screen->tme_gtk_screen_mouse_statusbar); | |
290 | + gtk_header_bar_pack_start(GTK_HEADER_BAR(screen->tme_gtk_screen_header), | |
291 | + screen->tme_gtk_screen_mouse_statusbar); | |
316 | 292 | |
317 | 293 | /* push an initial message onto the statusbar: */ |
318 | 294 | screen->tme_gtk_screen_mouse_statusbar_cid |
@@ -321,18 +297,18 @@ _tme_gtk_mouse_attach(struct tme_gtk_screen *screen) | ||
321 | 297 | gtk_statusbar_push(GTK_STATUSBAR(screen->tme_gtk_screen_mouse_statusbar), |
322 | 298 | screen->tme_gtk_screen_mouse_statusbar_cid, |
323 | 299 | _("The Machine Emulator")); |
324 | - | |
300 | + | |
325 | 301 | /* although the event mask doesn't include these events yet, |
326 | 302 | set a signal handler for the mouse events: */ |
327 | - g_signal_connect(screen->tme_gtk_screen_gtkframe, | |
303 | + g_signal_connect(screen->tme_gtk_screen_draw, | |
328 | 304 | "motion_notify_event", |
329 | 305 | G_CALLBACK(_tme_gtk_mouse_mouse_event), |
330 | 306 | screen->screen.tme_screen_display); |
331 | - g_signal_connect(screen->tme_gtk_screen_gtkframe, | |
307 | + g_signal_connect(screen->tme_gtk_screen_draw, | |
332 | 308 | "button_press_event", |
333 | 309 | G_CALLBACK(_tme_gtk_mouse_mouse_event), |
334 | 310 | screen->screen.tme_screen_display); |
335 | - g_signal_connect(screen->tme_gtk_screen_gtkframe, | |
311 | + g_signal_connect(screen->tme_gtk_screen_draw, | |
336 | 312 | "button_release_event", |
337 | 313 | G_CALLBACK(_tme_gtk_mouse_mouse_event), |
338 | 314 | screen->screen.tme_screen_display); |