Hello I have a question can we use xlib apis directly with gtk widget? I have written a code but xlib apis I used doesn’t work on the gtk widget here is my code
#include <gdk/x11/gdkx.h>
#include <gtk/gtk.h>
#include <X11/Xlib.h>
static void
activate (GtkApplication* app,
gpointer user_data)
{
GtkWidget *widget;
GdkDisplay* display;
GdkSurface* surface;
GtkNative* native;
Window window;
Display* xdisplay;
widget = gtk_application_window_new(app);
native = gtk_widget_get_native(widget);
surface = gtk_native_get_surface(native);
display = gdk_display_open(NULL);
xdisplay = gdk_x11_display_get_xdisplay(display);
surface = gdk_surface_new_toplevel (display);
window = gdk_x11_surface_get_xid(surface);
gtk_widget_show(widget);
XStoreName(xdisplay, window, "HERE");
XMoveWindow(xdisplay, window, 600, 200);
}
int
main (int argc,
char **argv)
{
GtkApplication *app;
int status;
app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}