void on_viewfinderArea_realize (GtkWidget * widget, gpointer data) { #if GTK_CHECK_VERSION (2, 18, 0) gdk_window_ensure_native (gtk_widget_get_window (widget)); #endif }
JNIEXPORT jboolean JNICALL Java_org_gnome_gdk_GdkWindow_gdk_1window_1ensure_1native ( JNIEnv* env, jclass cls, jlong _self ) { gboolean result; jboolean _result; GdkWindow* self; // convert parameter self self = (GdkWindow*) _self; // call function result = gdk_window_ensure_native(self); // cleanup parameter self // translate return value to JNI type _result = (jboolean) result; // and finally return _result; }
/* This function is called when the GUI toolkit creates the physical window that will hold the video. * At this point we can retrieve its handler (which has a different meaning depending on the windowing system) * and pass it to GStreamer through the VideoOverlay interface. */ static void realize_cb (GtkWidget *widget, CustomData *data) { GdkWindow *window = gtk_widget_get_window (widget); if (!gdk_window_ensure_native (window)) g_error ("Couldn't create native window needed for GstVidoeOverlay!"); /* Retrieve window handler from GDK */ window_handle = GDK_WINDOW_XID (window); }
/** * @todo Only from a gtk drawing area ? */ glc_drawable_t * glc_gtk_drawable_create( GtkDrawingArea * drawingArea ) { assert( drawingArea != 0 && "Calls glc_gtk_drawable_create() with an null drawing area." ); // Retrieves the window of the drawing area GdkWindow *gdkWindow = GTK_WIDGET(drawingArea)->window; if( gdkWindow == 0 ) { return 0; } // gdk_window_ensure_native() available from 2.18.0 #if GTKMM_VERSION >= 2180 else { // Ensure the gdk window is a window-system native window const gboolean isNative = gdk_window_ensure_native( gdkWindow ); if ( isNative == FALSE ) { assert( false && "Unable to ensure a window-sytem native window" ); return 0; } else { #ifdef WIN32 EnableWindow( (GLC_WINDOW_HANDLE) GDK_WINDOW_HWND( gdkWindow ), FALSE ); #endif } } #endif glc_drawable_t *drawable = (glc_drawable_t*) malloc( sizeof(glc_drawable_t) ); assert( drawable != 0 && "Unable to allocate glc_drawable_t." ); // Turns off the double buffering of the widget // So clearing to the background color or pixmap will no more happen automatically. gtk_widget_set_double_buffered( GTK_WIDGET(drawingArea), FALSE ); // Initializes the drawable #ifdef WIN32 drawable->window = (GLC_WINDOW_HANDLE) GDK_WINDOW_HWND( gdkWindow ); drawable->dc = GetDC( drawable->window ); #else #error "Non win32 platform not yet supported." #endif drawable->backend = (drawable_backend_t*) malloc( sizeof(drawable_backend_t) ); drawable->backend->destroy = &glc_gtk_drawable_destroy; _glc_drawable_initialize( drawable ); // @todo glc_gtk_drawable_status() assert( drawable->window != 0 ); assert( drawable->dc != 0 ); assert( drawable->backend != 0 ); return drawable; }
static void realize_cb (GtkWidget * widget, GstElement * pipeline) { #if GTK_CHECK_VERSION(2,18,0) if (!gdk_window_ensure_native (widget->window)) g_error ("Failed to create native window!"); #endif gst_element_set_state (pipeline, GST_STATE_PLAYING); }
sys_result_t ui_widget_getnative(ui_widget_t* widget, Window* xwindow) { GdkWindow* gdk_window = gtk_widget_get_window(widget->widget); gboolean is_native = gdk_window_ensure_native(gdk_window); if(!is_native) return CLIPT_EINVALID; Window ret = gdk_x11_window_get_xid(gdk_window); *xwindow = ret; return CLIPT_OK; }
static void area_realize_cb(GtkWidget* widget, GstElement* pipeline) { #if GTK_CHECK_VERSION(2,18,0) if (!gdk_window_ensure_native (widget->window)) g_error ("Failed to create native window!"); #endif //avoid flickering when resizing or obscuring the main window gdk_window_set_back_pixmap(widget->window, NULL, FALSE); gtk_widget_set_app_paintable(widget,TRUE); gtk_widget_set_double_buffered(widget, FALSE); gst_element_set_state (pipeline, GST_STATE_PLAYING); }
/* * @brief callback when GTK creates physical window * retrive handle and provide to gstreamer through XOverlay interface */ static void realise_cb (GtkWidget *widget, CustomData *data) { GdkWindow *window = gtk_widget_get_window (widget); guintptr window_handle; /* why so serius? */ if (!gdk_window_ensure_native (window)) { g_error ("couldn't create native window needed for GstXOverlay!"); } /* get window handle */ #ifdef GDK_WINDOWING_X11 window_handle = GDK_WINDOW_XID(window); #else #error "Unsupported platform!!" #endif /* pass window to xoverlay of playbin2 */ gst_x_overlay_set_window_handle(GST_X_OVERLAY (data->playbin2), window_handle); }
/* This function is called when the GUI toolkit creates the physical window that will hold the video. * At this point we can retrieve its handler (which has a different meaning depending on the windowing system) * and pass it to GStreamer through the XOverlay interface. */ static void realize_cb (GtkWidget *widget, CustomData *data) { GdkWindow *window = gtk_widget_get_window (widget); guintptr window_handle; if (!gdk_window_ensure_native (window)) g_error ("Couldn't create native window needed for GstXOverlay!"); /* Retrieve window handler from GDK */ #if defined (GDK_WINDOWING_WIN32) window_handle = (guintptr)GDK_WINDOW_HWND (window); #elif defined (GDK_WINDOWING_QUARTZ) window_handle = gdk_quartz_window_get_nsview (window); #elif defined (GDK_WINDOWING_X11) window_handle = GDK_WINDOW_XID (window); #endif /* Pass it to playbin, which implements XOverlay and will forward it to the video sink */ gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (data->playbin), window_handle); }
void GTKVideo::realize_cb(GtkWidget *widget, void *user_data) { GTKVideo *context = static_cast<GTKVideo *>(user_data); GdkWindow *window = gtk_widget_get_window(widget); if (!gdk_window_ensure_native(window)) g_debug("Couldn't create native window needed for GstXOverlay!"); gdk_threads_enter(); gdk_display_sync(context->display_); // gdk_error_trap_pop (); /* Retrieve window handler from GDK */ #if defined(GDK_WINDOWING_WIN32) context->window_handle_ = reinterpret_cast<guintptr>(GDK_WINDOW_HWND(window)); #elif defined(GDK_WINDOWING_QUARTZ) context->window_handle_ = gdk_quartz_window_get_nsview(window); #elif defined(GDK_WINDOWING_X11) context->window_handle_ = GDK_WINDOW_XID(window); #endif gdk_threads_leave(); std::unique_lock<std::mutex> lock(context->wait_window_mutex_); context->wait_window_cond_.notify_all(); }
static void native_window_clicked (GtkWidget *button, gpointer data) { GList *selected, *l; GdkWindow *window; selected = get_selected_windows (); for (l = selected; l != NULL; l = l->next) { window = l->data; gdk_window_ensure_native (window); } g_list_free (selected); update_store (); }
CoglOnscreen* ImGui_ImplGtk3Cogl_Init(GtkWidget* widget, void (*callback)(CoglOnscreen *onscreen, void *data), void *data) { g_clear_pointer(&g_GtkWidget, g_object_unref); g_clear_pointer(&g_GdkWindow, g_object_unref); g_clear_pointer(&g_Framebuffer, cogl_object_unref); g_clear_pointer(&g_Context, cogl_object_unref); g_GtkWidget = GTK_WIDGET(g_object_ref(widget)); gtk_widget_realize(widget); GdkWindow *parent_window = gtk_widget_get_window(widget); GtkAllocation allocation; gtk_widget_get_allocation(widget, &allocation); g_Callbacks = get_backend_callbacks(parent_window); GdkWindowAttr attributes; memset(&attributes, 0, sizeof(attributes)); attributes.x = 0; attributes.y = 0; attributes.width = allocation.width; attributes.height = allocation.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.window_type = g_Callbacks->winsys == COGL_WINSYS_ID_EGL_WAYLAND ? GDK_WINDOW_SUBSURFACE : GDK_WINDOW_CHILD; GdkDisplay *display = gdk_window_get_display(parent_window); attributes.visual = gtk_widget_get_visual(widget); g_GdkWindow = gdk_window_new(parent_window, &attributes, GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL); gdk_window_set_transient_for(g_GdkWindow, parent_window); gdk_window_set_pass_through(g_GdkWindow, TRUE); cairo_rectangle_int_t empty_rect; memset(&empty_rect, 0, sizeof(empty_rect)); cairo_region_t *input_region = cairo_region_create_rectangle(&empty_rect); gdk_window_input_shape_combine_region(g_GdkWindow, input_region, 0, 0); cairo_region_destroy(input_region); cairo_region_t *region = get_window_region(g_GdkWindow); gdk_window_set_opaque_region(g_GdkWindow, region); cairo_region_destroy(region); CoglRenderer *renderer = cogl_renderer_new(); cogl_renderer_set_winsys_id(renderer, g_Callbacks->winsys); g_Callbacks->init(renderer, display, g_GdkWindow); gdk_window_ensure_native(g_GdkWindow); g_Context = cogl_context_new(cogl_display_new(renderer, NULL), NULL); CoglOnscreen *onscreen = cogl_onscreen_new(g_Context, 1, 1); cogl_object_unref(renderer); g_Callbacks->resize(g_GdkWindow, onscreen, allocation.width, allocation.height, allocation.x, allocation.y); gtk_widget_add_events(widget, EVENT_MASK); g_signal_connect(widget, "event", G_CALLBACK(handle_gdk_event), NULL); g_signal_connect(widget, "size-allocate", G_CALLBACK(handle_allocate), NULL); g_Callbacks->set_window(onscreen, g_GdkWindow); if (!cogl_framebuffer_allocate(COGL_FRAMEBUFFER(onscreen), NULL)) g_warning("Unable to allocate framebuffer"); g_Framebuffer = COGL_FRAMEBUFFER(onscreen); ImGuiIO& io = ImGui::GetIO(); for (int i = 0; i < ImGuiKey_COUNT; i++) { io.KeyMap[i] = i; } io.SetClipboardTextFn = ImGui_ImplGtk3Cogl_SetClipboardText; io.GetClipboardTextFn = ImGui_ImplGtk3Cogl_GetClipboardText; io.ClipboardUserData = gtk_widget_get_clipboard(g_GtkWidget, GDK_SELECTION_CLIPBOARD); g_Callback = callback; g_CallbackData = data; GdkFrameClock *clock = gdk_window_get_frame_clock(g_GdkWindow); g_signal_connect(clock, "paint", G_CALLBACK(handle_repaint), NULL); gdk_frame_clock_request_phase(clock, GDK_FRAME_CLOCK_PHASE_PAINT); gdk_window_show(g_GdkWindow); return COGL_ONSCREEN(g_Framebuffer); }
static void area_realize_cb(GtkWidget* widget, gpointer data) { g_print ("realize %p\n", widget); if (!gdk_window_ensure_native (gtk_widget_get_window (widget))) g_error ("Failed to create native window!"); }
static void gth_media_viewer_page_real_activate (GthViewerPage *base, GthBrowser *browser) { GthMediaViewerPage *self; if (! gstreamer_init ()) return; self = (GthMediaViewerPage*) base; self->priv->browser = browser; self->priv->actions = gtk_action_group_new ("Video Viewer Actions"); gtk_action_group_set_translation_domain (self->priv->actions, NULL); gtk_action_group_add_actions (self->priv->actions, media_viewer_action_entries, G_N_ELEMENTS (media_viewer_action_entries), self); gtk_ui_manager_insert_action_group (gth_browser_get_ui_manager (browser), self->priv->actions, 0); self->priv->area_box = gtk_vbox_new (FALSE, 0); /* video area */ self->priv->area = gtk_drawing_area_new (); gtk_widget_set_double_buffered (self->priv->area, FALSE); gtk_widget_add_events (self->priv->area, (gtk_widget_get_events (self->priv->area) | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_MOTION_MASK)); GTK_WIDGET_SET_FLAGS (self->priv->area, GTK_CAN_FOCUS); gtk_widget_show (self->priv->area); gtk_box_pack_start (GTK_BOX (self->priv->area_box), self->priv->area, TRUE, TRUE, 0); g_signal_connect (G_OBJECT (self->priv->area), "realize", G_CALLBACK (video_area_realize_cb), self); g_signal_connect (G_OBJECT (self->priv->area), "unrealize", G_CALLBACK (video_area_unrealize_cb), self); g_signal_connect (G_OBJECT (self->priv->area), "expose_event", G_CALLBACK (video_area_expose_event_cb), self); g_signal_connect (G_OBJECT (self->priv->area), "button_press_event", G_CALLBACK (video_area_button_press_cb), self); g_signal_connect (G_OBJECT (self->priv->area), "scroll_event", G_CALLBACK (video_area_scroll_event_cb), self); g_signal_connect (G_OBJECT (self->priv->area), "key_press_event", G_CALLBACK (video_area_key_press_cb), self); /* mediabar */ self->priv->builder = _gtk_builder_new_from_file ("mediabar.ui", "gstreamer_tools"); self->priv->mediabar = GET_WIDGET ("mediabar"); gtk_widget_show (self->priv->mediabar); gtk_box_pack_start (GTK_BOX (self->priv->area_box), self->priv->mediabar, FALSE, FALSE, 0); g_signal_connect (GET_WIDGET ("adjustment_volume"), "value-changed", G_CALLBACK (volume_value_changed_cb), self); g_signal_connect (GET_WIDGET ("adjustment_position"), "value-changed", G_CALLBACK (position_value_changed_cb), self); g_signal_connect (GET_WIDGET ("hscale_volume"), "format-value", G_CALLBACK (hscale_volume_format_value_cb), self); g_signal_connect (GET_WIDGET ("hscale_position"), "change-value", G_CALLBACK (hscale_position_change_value_cb), self); g_signal_connect (GET_WIDGET ("hscale_position"), "button-release-event", G_CALLBACK (hscale_position_button_release_event_cb), self); g_signal_connect (GET_WIDGET ("button_play"), "clicked", G_CALLBACK (button_play_clicked_cb), self); g_signal_connect (GET_WIDGET ("togglebutton_volume"), "toggled", G_CALLBACK (togglebutton_volume_toggled_cb), self); g_signal_connect (GET_WIDGET ("button_play_slower"), "clicked", G_CALLBACK (button_play_slower_clicked_cb), self); g_signal_connect (GET_WIDGET ("button_play_faster"), "clicked", G_CALLBACK (button_play_faster_clicked_cb), self); gtk_widget_show (self->priv->area_box); gth_browser_set_viewer_widget (browser, self->priv->area_box); gtk_widget_realize (self->priv->area); gdk_window_ensure_native (gtk_widget_get_window (self->priv->area)); gth_viewer_page_focus (GTH_VIEWER_PAGE (self)); }
void on_viewfinderArea_realize (GtkWidget * widget, gpointer data) { gdk_window_ensure_native (gtk_widget_get_window (widget)); }
void ghb_preview_init(signal_user_data_t *ud) { GtkWidget *widget; ud->preview = g_malloc0(sizeof(preview_t)); ud->preview->view = GHB_WIDGET(ud->builder, "preview_image"); gtk_widget_realize(ud->preview->view); ud->preview->pause = TRUE; ud->preview->encode_frame = -1; ud->preview->live_id = -1; widget = GHB_WIDGET(ud->builder, "preview_button_image"); gtk_widget_get_size_request(widget, &ud->preview->button_width, &ud->preview->button_height); widget = GHB_WIDGET(ud->builder, "preview_hud"); gtk_widget_realize(widget); // Use a native window for the HUD. Client side windows don't get // updated properly as video changes benieth them. // This also seems to be required to make the preview hud visible // on win32. otherwise it is transparent for some reason. if (!gdk_window_ensure_native(gtk_widget_get_window(widget))) { g_message("Couldn't create native window for HUD."); } #if defined(_ENABLE_GST) GstBus *bus; GstElement *xover; if (!gdk_window_ensure_native(preview_window(ud->preview->view))) { g_message("Couldn't create native window for GstXOverlay. Disabling live preview."); GtkWidget *widget = GHB_WIDGET(ud->builder, "live_preview_box"); gtk_widget_hide (widget); widget = GHB_WIDGET(ud->builder, "live_preview_duration_box"); gtk_widget_hide (widget); return; } #if !defined(_WIN32) ud->preview->xid = GDK_WINDOW_XID(preview_window(ud->preview->view)); #else ud->preview->xid = GDK_WINDOW_HWND(preview_window(ud->preview->view)); #endif ud->preview->play = gst_element_factory_make("playbin", "play"); xover = gst_element_factory_make("gconfvideosink", "xover"); if (xover == NULL) { xover = gst_element_factory_make("xvimagesink", "xover"); } if (xover == NULL) { xover = gst_element_factory_make("ximagesink", "xover"); } if (xover == NULL) { xover = gst_element_factory_make("autovideosink", "xover"); } if (ud->preview->play == NULL || xover == NULL) { g_message("Couldn't initialize gstreamer. Disabling live preview."); GtkWidget *widget = GHB_WIDGET(ud->builder, "live_preview_box"); gtk_widget_hide (widget); widget = GHB_WIDGET(ud->builder, "live_preview_duration_box"); gtk_widget_hide (widget); return; } else { g_object_set(G_OBJECT(ud->preview->play), "video-sink", xover, NULL); g_object_set(ud->preview->play, "subtitle-font-desc", "sans bold 20", NULL); bus = gst_pipeline_get_bus(GST_PIPELINE(ud->preview->play)); gst_bus_add_watch(bus, live_preview_cb, ud); #if GST_CHECK_VERSION(1, 0, 0) gst_bus_set_sync_handler(bus, create_window, ud->preview, NULL); #else gst_bus_set_sync_handler(bus, create_window, ud->preview); #endif gst_object_unref(bus); ud->preview->live_enabled = 1; } #else widget = GHB_WIDGET(ud->builder, "live_preview_box"); gtk_widget_hide (widget); widget = GHB_WIDGET(ud->builder, "live_preview_duration_box"); gtk_widget_hide (widget); #endif }
int main (int argc, char *argv[]) { SnraClient *client = NULL; int ret = 1; const gchar *server = NULL; GOptionContext *ctx; GError *error = NULL; GtkWidget *window, *eventbox, *button; ctx = g_option_context_new ("Aurena fullscreen client"); g_option_context_add_group (ctx, gtk_get_option_group(TRUE)); g_option_context_add_group (ctx, gst_init_get_option_group()); if (!g_option_context_parse (ctx, &argc, &argv, &error)) { g_print ("Arguments error: %s", error->message); return 1; } g_option_context_free (ctx); if (argc > 1) { /* Connect directly to the requested server, no avahi */ server = argv[1]; } avahi_set_allocator (avahi_glib_allocator ()); client = snra_client_new (server, SNRA_CLIENT_PLAYER); if (client == NULL) goto fail; g_object_set (gtk_settings_get_default (), "gtk-application-prefer-dark-theme", TRUE, NULL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_set_double_buffered (window, FALSE); gtk_widget_set_redraw_on_allocate (window, FALSE); gtk_widget_set_app_paintable (window, TRUE); g_signal_connect_after (window, "delete-event", G_CALLBACK (quit_clicked), NULL); eventbox = gtk_event_box_new (); g_object_set (eventbox, "halign", GTK_ALIGN_END, "valign", GTK_ALIGN_START, "expand", FALSE, NULL); gtk_widget_set_double_buffered (eventbox, TRUE); gtk_widget_set_redraw_on_allocate (eventbox, TRUE); gtk_widget_set_app_paintable (eventbox, FALSE); gtk_container_add (GTK_CONTAINER (window), eventbox); button = gtk_button_new_from_stock (GTK_STOCK_QUIT); gtk_container_add (GTK_CONTAINER (eventbox), button); g_signal_connect (button, "clicked", G_CALLBACK (quit_clicked), NULL); gtk_window_fullscreen (GTK_WINDOW (window)); gtk_widget_show_all (window); g_signal_connect (client, "player-created", G_CALLBACK(player_created), window); gtk_widget_realize (button); gdk_window_ensure_native (gtk_widget_get_window (eventbox)); ml = g_main_loop_new (NULL, FALSE); g_main_loop_run (ml); ret = 0; fail: if (client) g_object_unref (client); if (ml) g_main_loop_unref (ml); return ret; }
static void realize_cb (GtkWidget * widget) { /* using a native window avoids redrawing parent widgets */ gdk_window_ensure_native (gtk_widget_get_window (widget)); }
static gboolean clutter_stage_gdk_realize (ClutterStageWindow *stage_window) { ClutterStageGdk *stage_gdk = CLUTTER_STAGE_GDK (stage_window); ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window); ClutterBackend *backend = CLUTTER_BACKEND (stage_cogl->backend); ClutterBackendGdk *backend_gdk = CLUTTER_BACKEND_GDK (backend); GdkWindowAttr attributes; gboolean cursor_visible; gboolean use_alpha; gfloat width, height; if (stage_gdk->foreign_window) { width = gdk_window_get_width (stage_gdk->window); height = gdk_window_get_height (stage_gdk->window); } else { if (stage_gdk->window != NULL) { /* complete realizing the stage */ cairo_rectangle_int_t geometry; clutter_stage_gdk_get_geometry (stage_window, &geometry); clutter_actor_set_size (CLUTTER_ACTOR (stage_cogl->wrapper), geometry.width, geometry.height); gdk_window_ensure_native (stage_gdk->window); gdk_window_set_events (stage_gdk->window, CLUTTER_STAGE_GDK_EVENT_MASK); return TRUE; } else { attributes.title = NULL; g_object_get (stage_cogl->wrapper, "cursor-visible", &cursor_visible, "title", &attributes.title, "width", &width, "height", &height, "use-alpha", &use_alpha, NULL); attributes.width = width; attributes.height = height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.window_type = GDK_WINDOW_TOPLEVEL; attributes.event_mask = CLUTTER_STAGE_GDK_EVENT_MASK; attributes.cursor = NULL; if (!cursor_visible) { if (stage_gdk->blank_cursor == NULL) stage_gdk->blank_cursor = gdk_cursor_new_for_display (backend_gdk->display, GDK_BLANK_CURSOR); attributes.cursor = stage_gdk->blank_cursor; } attributes.visual = NULL; if (use_alpha) { attributes.visual = gdk_screen_get_rgba_visual (backend_gdk->screen); if (attributes.visual == NULL) clutter_stage_set_use_alpha (stage_cogl->wrapper, FALSE); } if (attributes.visual == NULL) { /* This could still be an RGBA visual, although normally it's not */ attributes.visual = gdk_screen_get_system_visual (backend_gdk->screen); } stage_gdk->foreign_window = FALSE; stage_gdk->window = gdk_window_new (NULL, &attributes, GDK_WA_TITLE | GDK_WA_CURSOR | GDK_WA_VISUAL); g_free (attributes.title); } clutter_stage_gdk_set_gdk_geometry (stage_gdk); } gdk_window_ensure_native (stage_gdk->window); g_object_set_data (G_OBJECT (stage_gdk->window), "clutter-stage-window", stage_gdk); stage_cogl->onscreen = cogl_onscreen_new (backend->cogl_context, width, height); #if defined(GDK_WINDOWING_X11) && defined(COGL_HAS_XLIB_SUPPORT) if (GDK_IS_X11_WINDOW (stage_gdk->window)) { cogl_x11_onscreen_set_foreign_window_xid (stage_cogl->onscreen, GDK_WINDOW_XID (stage_gdk->window), clutter_stage_gdk_update_foreign_event_mask, stage_gdk); } else #endif #if defined(GDK_WINDOWING_WAYLAND) && defined(COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT) if (GDK_IS_WAYLAND_WINDOW (stage_gdk->window)) { cogl_wayland_onscreen_set_foreign_surface (stage_cogl->onscreen, gdk_wayland_window_get_wl_surface (stage_gdk->window)); } else #endif #if defined(GDK_WINDOWING_WIN32) && defined(COGL_HAS_WIN32_SUPPORT) if (GDK_IS_WIN32_WINDOW (stage_gdk->window)) { cogl_win32_onscreen_set_foreign_window (stage_cogl->onscreen, gdk_win32_window_get_handle (stage_gdk->window)); } else #endif { g_warning ("Cannot find an appropriate CoglWinsys for a " "GdkWindow of type %s", G_OBJECT_TYPE_NAME (stage_gdk->window)); cogl_object_unref (stage_cogl->onscreen); stage_cogl->onscreen = NULL; if (!stage_gdk->foreign_window) gdk_window_destroy (stage_gdk->window); stage_gdk->window = NULL; return FALSE; } return clutter_stage_window_parent_iface->realize (stage_window); }
void gdk_property_change (GdkWindow *window, GdkAtom property, GdkAtom type, gint format, GdkPropMode mode, const guchar *data, gint nelements) { GdkDisplay *display; Window xwindow; Atom xproperty; Atom xtype; g_return_if_fail (!window || GDK_WINDOW_IS_X11 (window)); if (!window) { GdkScreen *screen; screen = gdk_screen_get_default (); window = gdk_screen_get_root_window (screen); GDK_NOTE (MULTIHEAD, g_message ("gdk_property_change(): window is NULL\n")); } else if (!GDK_WINDOW_IS_X11 (window)) return; if (GDK_WINDOW_DESTROYED (window)) return; gdk_window_ensure_native (window); display = gdk_drawable_get_display (window); xproperty = gdk_x11_atom_to_xatom_for_display (display, property); xtype = gdk_x11_atom_to_xatom_for_display (display, type); xwindow = GDK_WINDOW_XID (window); if (xtype == XA_ATOM || xtype == gdk_x11_get_xatom_by_name_for_display (display, "ATOM_PAIR")) { /* * data is an array of GdkAtom, we need to convert it * to an array of X Atoms */ gint i; GdkAtom *atoms = (GdkAtom*) data; Atom *xatoms; xatoms = g_new (Atom, nelements); for (i = 0; i < nelements; i++) xatoms[i] = gdk_x11_atom_to_xatom_for_display (display, atoms[i]); XChangeProperty (GDK_DISPLAY_XDISPLAY (display), xwindow, xproperty, xtype, format, mode, (guchar *)xatoms, nelements); g_free (xatoms); } else XChangeProperty (GDK_DISPLAY_XDISPLAY (display), xwindow, xproperty, xtype, format, mode, (guchar *)data, nelements); }