Mercurial > dwindows
comparison gtk3/dw.c @ 2344:88f7e871b283
GTK3: Back port dw_window_destroy() fix from GTK4 and code cleanups.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 04 Mar 2021 03:05:56 +0000 |
parents | 347b0f97c295 |
children | e3d2058ea96a |
comparison
equal
deleted
inserted
replaced
2343:347b0f97c295 | 2344:88f7e871b283 |
---|---|
2618 for(z=0;z<boxcount;z++) | 2618 for(z=0;z<boxcount;z++) |
2619 { | 2619 { |
2620 if(gtk_grid_get_child_at(GTK_GRID(box), 0, z) == handle2) | 2620 if(gtk_grid_get_child_at(GTK_GRID(box), 0, z) == handle2) |
2621 { | 2621 { |
2622 gtk_grid_remove_row(GTK_GRID(box), z); | 2622 gtk_grid_remove_row(GTK_GRID(box), z); |
2623 handle2 = NULL; | |
2623 break; | 2624 break; |
2624 } | 2625 } |
2625 } | 2626 } |
2626 } | 2627 } |
2627 else | 2628 else |
2629 for(z=0;z<boxcount;z++) | 2630 for(z=0;z<boxcount;z++) |
2630 { | 2631 { |
2631 if(gtk_grid_get_child_at(GTK_GRID(box), z, 0) == handle2) | 2632 if(gtk_grid_get_child_at(GTK_GRID(box), z, 0) == handle2) |
2632 { | 2633 { |
2633 gtk_grid_remove_column(GTK_GRID(box), z); | 2634 gtk_grid_remove_column(GTK_GRID(box), z); |
2635 handle2 = NULL; | |
2634 break; | 2636 break; |
2635 } | 2637 } |
2636 } | 2638 } |
2637 } | 2639 } |
2638 #endif | 2640 #endif |
2645 } | 2647 } |
2646 } | 2648 } |
2647 /* Finally destroy the widget, make sure it is still | 2649 /* Finally destroy the widget, make sure it is still |
2648 * a valid widget if it got removed from the grid. | 2650 * a valid widget if it got removed from the grid. |
2649 */ | 2651 */ |
2650 if(GTK_IS_WIDGET(handle2)) | 2652 if(handle2 && GTK_IS_WIDGET(handle2)) |
2651 gtk_widget_destroy(handle2); | 2653 gtk_widget_destroy(handle2); |
2652 } | 2654 } |
2653 DW_MUTEX_UNLOCK; | 2655 DW_MUTEX_UNLOCK; |
2654 return 0; | 2656 return 0; |
2655 } | 2657 } |
7324 if(!window || !GDK_IS_WINDOW(window)) | 7326 if(!window || !GDK_IS_WINDOW(window)) |
7325 { | 7327 { |
7326 DW_MUTEX_UNLOCK; | 7328 DW_MUTEX_UNLOCK; |
7327 return; | 7329 return; |
7328 } | 7330 } |
7329 #if GTK_CHECK_VERSION(3,22,0) | 7331 #if GTK_CHECK_VERSION(3,22,0) |
7330 clip = gdk_window_get_clip_region(window); | 7332 clip = gdk_window_get_clip_region(window); |
7331 dc = gdk_window_begin_draw_frame(window, clip); | 7333 dc = gdk_window_begin_draw_frame(window, clip); |
7332 cr = gdk_drawing_context_get_cairo_context(dc); | 7334 cr = gdk_drawing_context_get_cairo_context(dc); |
7333 #else | 7335 #else |
7334 cr = gdk_cairo_create(window); | 7336 cr = gdk_cairo_create(window); |
7335 #endif | 7337 #endif |
7336 } | 7338 } |
7337 else | 7339 else |
7338 { | 7340 { |
7339 /* If not X11, just mark the widget dirty.. and trigger draw in dw_flush() */ | 7341 /* If not X11, just mark the widget dirty.. and trigger draw in dw_flush() */ |
7340 if(g_list_find(_dw_dirty_list, handle) == NULL) | 7342 if(g_list_find(_dw_dirty_list, handle) == NULL) |
7396 if(!window || !GDK_IS_WINDOW(window)) | 7398 if(!window || !GDK_IS_WINDOW(window)) |
7397 { | 7399 { |
7398 DW_MUTEX_UNLOCK; | 7400 DW_MUTEX_UNLOCK; |
7399 return; | 7401 return; |
7400 } | 7402 } |
7401 #if GTK_CHECK_VERSION(3,22,0) | 7403 #if GTK_CHECK_VERSION(3,22,0) |
7402 clip = gdk_window_get_clip_region(window); | 7404 clip = gdk_window_get_clip_region(window); |
7403 dc = gdk_window_begin_draw_frame(window, clip); | 7405 dc = gdk_window_begin_draw_frame(window, clip); |
7404 cr = gdk_drawing_context_get_cairo_context(dc); | 7406 cr = gdk_drawing_context_get_cairo_context(dc); |
7405 #else | 7407 #else |
7406 cr = gdk_cairo_create(window); | 7408 cr = gdk_cairo_create(window); |
7407 #endif | 7409 #endif |
7408 } | 7410 } |
7409 else | 7411 else |
7410 { | 7412 { |
7411 /* If not X11, just mark the widget dirty.. and trigger draw in dw_flush() */ | 7413 /* If not X11, just mark the widget dirty.. and trigger draw in dw_flush() */ |
7412 if(g_list_find(_dw_dirty_list, handle) == NULL) | 7414 if(g_list_find(_dw_dirty_list, handle) == NULL) |
7470 if(!window || !GDK_IS_WINDOW(window)) | 7472 if(!window || !GDK_IS_WINDOW(window)) |
7471 { | 7473 { |
7472 DW_MUTEX_UNLOCK; | 7474 DW_MUTEX_UNLOCK; |
7473 return; | 7475 return; |
7474 } | 7476 } |
7475 #if GTK_CHECK_VERSION(3,22,0) | 7477 #if GTK_CHECK_VERSION(3,22,0) |
7476 clip = gdk_window_get_clip_region(window); | 7478 clip = gdk_window_get_clip_region(window); |
7477 dc = gdk_window_begin_draw_frame(window, clip); | 7479 dc = gdk_window_begin_draw_frame(window, clip); |
7478 cr = gdk_drawing_context_get_cairo_context(dc); | 7480 cr = gdk_drawing_context_get_cairo_context(dc); |
7479 #else | 7481 #else |
7480 cr = gdk_cairo_create(window); | 7482 cr = gdk_cairo_create(window); |
7481 #endif | 7483 #endif |
7482 } | 7484 } |
7483 else | 7485 else |
7484 { | 7486 { |
7485 /* If not X11, just mark the widget dirty.. and trigger draw in dw_flush() */ | 7487 /* If not X11, just mark the widget dirty.. and trigger draw in dw_flush() */ |
7486 if(g_list_find(_dw_dirty_list, handle) == NULL) | 7488 if(g_list_find(_dw_dirty_list, handle) == NULL) |
7552 if(!window || !GDK_IS_WINDOW(window)) | 7554 if(!window || !GDK_IS_WINDOW(window)) |
7553 { | 7555 { |
7554 DW_MUTEX_UNLOCK; | 7556 DW_MUTEX_UNLOCK; |
7555 return; | 7557 return; |
7556 } | 7558 } |
7557 #if GTK_CHECK_VERSION(3,22,0) | 7559 #if GTK_CHECK_VERSION(3,22,0) |
7558 clip = gdk_window_get_clip_region(window); | 7560 clip = gdk_window_get_clip_region(window); |
7559 dc = gdk_window_begin_draw_frame(window, clip); | 7561 dc = gdk_window_begin_draw_frame(window, clip); |
7560 cr = gdk_drawing_context_get_cairo_context(dc); | 7562 cr = gdk_drawing_context_get_cairo_context(dc); |
7561 #else | 7563 #else |
7562 cr = gdk_cairo_create(window); | 7564 cr = gdk_cairo_create(window); |
7563 #endif | 7565 #endif |
7564 } | 7566 } |
7565 else | 7567 else |
7566 { | 7568 { |
7567 /* If not X11, just mark the widget dirty.. and trigger draw in dw_flush() */ | 7569 /* If not X11, just mark the widget dirty.. and trigger draw in dw_flush() */ |
7568 if(g_list_find(_dw_dirty_list, handle) == NULL) | 7570 if(g_list_find(_dw_dirty_list, handle) == NULL) |
7636 if(!window || !GDK_IS_WINDOW(window)) | 7638 if(!window || !GDK_IS_WINDOW(window)) |
7637 { | 7639 { |
7638 DW_MUTEX_UNLOCK; | 7640 DW_MUTEX_UNLOCK; |
7639 return; | 7641 return; |
7640 } | 7642 } |
7641 #if GTK_CHECK_VERSION(3,22,0) | 7643 #if GTK_CHECK_VERSION(3,22,0) |
7642 clip = gdk_window_get_clip_region(window); | 7644 clip = gdk_window_get_clip_region(window); |
7643 dc = gdk_window_begin_draw_frame(window, clip); | 7645 dc = gdk_window_begin_draw_frame(window, clip); |
7644 cr = gdk_drawing_context_get_cairo_context(dc); | 7646 cr = gdk_drawing_context_get_cairo_context(dc); |
7645 #else | 7647 #else |
7646 cr = gdk_cairo_create(window); | 7648 cr = gdk_cairo_create(window); |
7647 #endif | 7649 #endif |
7648 } | 7650 } |
7649 else | 7651 else |
7650 { | 7652 { |
7651 /* If not X11, just mark the widget dirty.. and trigger draw in dw_flush() */ | 7653 /* If not X11, just mark the widget dirty.. and trigger draw in dw_flush() */ |
7652 if(g_list_find(_dw_dirty_list, handle) == NULL) | 7654 if(g_list_find(_dw_dirty_list, handle) == NULL) |
7732 if(!window || !GDK_IS_WINDOW(window)) | 7734 if(!window || !GDK_IS_WINDOW(window)) |
7733 { | 7735 { |
7734 DW_MUTEX_UNLOCK; | 7736 DW_MUTEX_UNLOCK; |
7735 return; | 7737 return; |
7736 } | 7738 } |
7737 #if GTK_CHECK_VERSION(3,22,0) | 7739 #if GTK_CHECK_VERSION(3,22,0) |
7738 clip = gdk_window_get_clip_region(window); | 7740 clip = gdk_window_get_clip_region(window); |
7739 dc = gdk_window_begin_draw_frame(window, clip); | 7741 dc = gdk_window_begin_draw_frame(window, clip); |
7740 cr = gdk_drawing_context_get_cairo_context(dc); | 7742 cr = gdk_drawing_context_get_cairo_context(dc); |
7741 #else | 7743 #else |
7742 cr = gdk_cairo_create(window); | 7744 cr = gdk_cairo_create(window); |
7743 #endif | 7745 #endif |
7744 if((tmpname = (char *)g_object_get_data(G_OBJECT(handle), "_dw_fontname"))) | 7746 if((tmpname = (char *)g_object_get_data(G_OBJECT(handle), "_dw_fontname"))) |
7745 fontname = tmpname; | 7747 fontname = tmpname; |
7746 } | 7748 } |
7747 else | 7749 else |
7748 { | 7750 { |