static void _update_input_shape (GtkWidget* window, int width, int height) { static GdkBitmap* pShapeBitmap = NULL; static cairo_t* pCairoContext = NULL; g_return_if_fail (GTK_IS_WINDOW (window)); pShapeBitmap = (GdkBitmap*) gdk_pixmap_new (NULL, width, height, 1); if (pShapeBitmap) { pCairoContext = gdk_cairo_create (pShapeBitmap); if (cairo_status (pCairoContext) == CAIRO_STATUS_SUCCESS) { render_pixmap (pCairoContext, width, height); cairo_destroy (pCairoContext); #if !GTK_CHECK_VERSION(2,9,0) do_shape_combine_mask (window->window, NULL, 0, 0); do_shape_combine_mask (window->window, pShapeBitmap, 0, 0); #else gtk_widget_input_shape_combine_mask (window, NULL, 0, 0); gtk_widget_input_shape_combine_mask (window, pShapeBitmap, 0, 0); #endif } if (pShapeBitmap) g_object_unref ((gpointer) pShapeBitmap); } }
void update_input_shape (GtkWidget* pWindow, int iWidth, int iHeight) { static GdkBitmap* pShapeBitmap = NULL; static cairo_t* pCairoContext = NULL; pShapeBitmap = (GdkBitmap*) gdk_pixmap_new (NULL, iWidth, iHeight, 1); if (pShapeBitmap) { pCairoContext = gdk_cairo_create (pShapeBitmap); if (cairo_status (pCairoContext) == CAIRO_STATUS_SUCCESS) { render (pCairoContext, iWidth, iHeight); cairo_destroy (pCairoContext); #if !GTK_CHECK_VERSION(2,9,0) do_shape_combine_mask (pWindow->window, NULL, 0, 0); do_shape_combine_mask (pWindow->window, pShapeBitmap, 0, 0); #else gtk_widget_input_shape_combine_mask (pWindow, NULL, 0, 0); gtk_widget_input_shape_combine_mask (pWindow, pShapeBitmap, 0, 0); #endif } g_object_unref ((gpointer) pShapeBitmap); } }