[vulkan linux] Fix native_platform_handle with gtk
Use gtk connection as handle and use it when creating surface.
This commit is contained in:
parent
0965975cbe
commit
6d591970ab
|
@ -73,10 +73,6 @@ bool VulkanContext::Initialize() {
|
|||
#ifdef GDK_WINDOWING_X11
|
||||
GtkWidget* window_handle =
|
||||
static_cast<GtkWidget*>(target_window_->native_handle());
|
||||
GdkDisplay* gdk_display = gtk_widget_get_display(window_handle);
|
||||
assert(GDK_IS_X11_DISPLAY(gdk_display));
|
||||
xcb_connection_t* connection =
|
||||
XGetXCBConnection(gdk_x11_display_get_xdisplay(gdk_display));
|
||||
xcb_window_t window =
|
||||
gdk_x11_window_get_xid(gtk_widget_get_window(window_handle));
|
||||
VkXcbSurfaceCreateInfoKHR create_info;
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include <X11/Xlib-xcb.h>
|
||||
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/logging.h"
|
||||
#include "xenia/base/platform_linux.h"
|
||||
|
@ -81,6 +83,10 @@ void GTKWindow::Create() {
|
|||
NULL);
|
||||
g_signal_connect(G_OBJECT(window_), "event", G_CALLBACK(gtk_event_handler_),
|
||||
reinterpret_cast<gpointer>(this));
|
||||
|
||||
GdkDisplay* gdk_display = gtk_widget_get_display(window_);
|
||||
assert(GDK_IS_X11_DISPLAY(gdk_display));
|
||||
connection_ = XGetXCBConnection(gdk_x11_display_get_xdisplay(gdk_display));
|
||||
}
|
||||
|
||||
bool GTKWindow::OnCreate() {
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include <gdk/gdkx.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
#include "xenia/base/platform_linux.h"
|
||||
#include "xenia/ui/menu_item.h"
|
||||
|
@ -31,7 +32,7 @@ class GTKWindow : public Window {
|
|||
~GTKWindow() override;
|
||||
|
||||
NativePlatformHandle native_platform_handle() const override {
|
||||
return nullptr;
|
||||
return connection_;
|
||||
}
|
||||
NativeWindowHandle native_handle() const override { return window_; }
|
||||
|
||||
|
@ -74,6 +75,7 @@ class GTKWindow : public Window {
|
|||
private:
|
||||
void Create();
|
||||
GtkWidget* window_;
|
||||
xcb_connection_t* connection_;
|
||||
|
||||
friend void gtk_event_handler_(GtkWidget*, GdkEvent*, gpointer);
|
||||
bool HandleMouse(GdkEventAny* event);
|
||||
|
|
Loading…
Reference in New Issue