Compare commits

...

7 Commits

Author SHA1 Message Date
Christopher A. Mosher 2f60950f0c update boost version on windows from nt6 to nt62 2023-01-05 08:55:06 -05:00
Christopher A. Mosher a0c7be4019 debug windows build failure (link error due to mismatching boost library type) 2023-01-05 08:04:36 -05:00
Christopher A. Mosher 3790c0b971 debug windows build failure (link error due to mismatching boost library type) 2023-01-05 07:57:15 -05:00
Christopher A. Mosher 0c690c8b95 debug windows build failure (link error due to mismatching boost library type) 2023-01-05 07:48:23 -05:00
Christopher A. Mosher 9f221962ce fix build gtk only on linux 2023-01-05 07:16:10 -05:00
Christopher A. Mosher fd2aadfd17 add gtk to linux build setup 2023-01-05 07:10:52 -05:00
Christopher A. Mosher 9457f167ab fix new sdl panel on gtk 2023-01-05 07:05:12 -05:00
6 changed files with 66 additions and 9 deletions

View File

@ -88,6 +88,7 @@ emulator.cpp
filterchroma.cpp
filterluma.cpp
firmwarecard.cpp
gtkutil.cpp
gui.cpp
keyboardbuffermode.cpp
keyboard.cpp
@ -186,13 +187,20 @@ target_compile_definitions(${APP_NAME} PRIVATE
BOOST_THREAD_DYN_LINK
BOOST_ALL_NO_LIB
BOOST_LIB_DIAGNOSTIC
BOOST_USE_WINAPI_VERSION=0x0600)
BOOST_USE_WINAPI_VERSION=0x0602)
target_link_libraries(${APP_NAME} PRIVATE ${Boost_LIBRARIES})
find_package(wxWidgets REQUIRED COMPONENTS base core xrc qa)
include(${wxWidgets_USE_FILE})
target_link_libraries(${APP_NAME} PRIVATE ${wxWidgets_LIBRARIES})
if(NOT (APPLE OR WIN32))
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTKMM REQUIRED gtk+-3.0)
target_include_directories(${APP_NAME} PRIVATE ${GTKMM_INCLUDE_DIRS})
target_link_libraries(${APP_NAME} PRIVATE ${GTKMM_LIBRARIES})
endif()
configure_file(src/config.h.in config.h)

View File

@ -6,5 +6,5 @@ echo "::endgroup::"
echo "::group::install dependencies"
sudo apt-get -qqqq update
sudo apt-get -qqqq install libboost-all-dev libwxgtk3.2-dev libsdl2-dev
sudo apt-get -qqqq install libboost-all-dev libwxgtk3.2-dev libsdl2-dev libgtk-3-dev
echo "::endgroup::"

View File

@ -1,3 +1,5 @@
#!/bin/sh
objdump -p D:/a/_temp/msys64/mingw64/bin/libboost_log-mt.dll
exit 0

19
src/gtkutil.cpp Normal file
View File

@ -0,0 +1,19 @@
#include "gtkutil.h"
#ifdef __WXGTK__
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
void *get_gtk_native_window_handle(void *widget) {
GtkWidget *gtk_widget = GTK_WIDGET(widget);
gtk_widget_realize(gtk_widget);
GdkWindow *gdk_window = gtk_widget_get_window(gtk_widget);
Window xid = gdk_x11_window_get_xid(gdk_window);
return reinterpret_cast<void*>(xid);
}
#endif

17
src/gtkutil.h Normal file
View File

@ -0,0 +1,17 @@
/*
* File: gtkutil.h
* Author: user
*
* Created on January 4, 2023, 7:18 AM
*/
#ifndef GTKUTIL_H
#define GTKUTIL_H
#ifdef __WXGTK__
void *get_gtk_native_window_handle(void *widget);
#endif
#endif /* GTKUTIL_H */

View File

@ -21,8 +21,10 @@
#include "e2const.h"
#include "applentsc.h"
#include "card.h"
#include "gtkutil.h"
#include "util.h"
#include <wx/menu.h>
#include <wx/panel.h>
#include <wx/sizer.h>
#include <wx/gdicmn.h>
@ -74,6 +76,7 @@ ScreenImage::ScreenImage(KeyEventHandler &k) :
cassOutName(32, ' '),
keyEventHandler(k) {
createScreen();
Center();
Show();
Bind(wxEVT_IDLE, &ScreenImage::OnIdle, this);
}
@ -120,19 +123,27 @@ void ScreenImage::createScreen() {
notifyObservers();
}
void ScreenImage::createSdlTexture() {
WXWidget nativeSdl = this->sdl->GetHandle();
// TODO: do we need special gtk handling here, to get xid using:
// GtkWidget* widget = panel->GetHandle();
// gtk_widget_realize(widget);
// Window xid = GDK_WINDOW_XWINDOW(widget->window);
static void *get_native_window_handle(wxWindowBase *panel) {
void *vn = static_cast<void*>(panel->GetHandle());
#ifdef __WXGTK__
vn = get_gtk_native_window_handle(vn);
#endif
return vn;
}
this->window = SDL_CreateWindowFrom(static_cast<void*>(nativeSdl));
void ScreenImage::createSdlTexture() {
void *nativeSdl = get_native_window_handle(this->sdl);
this->window = SDL_CreateWindowFrom(nativeSdl);
if (this->window == NULL) {
printf("Unable to create window: %s\n", SDL_GetError());
throw ScreenException();
}
#ifdef __WXGTK__
SDL_SetWindowSize(this->window, SCRW, SCRH*ASPECT_RATIO);
#endif
this->renderer = SDL_CreateRenderer(this->window, -1, 0);
if (this->renderer == NULL) {
std::cerr << SDL_GetError() << std::endl;