mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-30 15:59:56 +02:00
Update to v106r39 release.
byuu says: Changelog: - ruby/video: implement onUpdate() callback to signal when redraws are necessary - ruby/video/GLX,GLX2,XVideo,XShm: implement onUpdate() support - bsnes: implement Video::onUpdate() support to redraw Viewport icon as needed - bsnes: save RAM before ruby driver changes - sfc/sa1: clip signed multiplication to 32-bit [Jonas Quinn] - sfc/sa1: handle negative dividends in division [Jonas Quinn] - hiro/gtk3: a few improvements - bsnes: added empty stub video and audio settings panels - bsnes: restructured advanced settings panel - bsnes: experiment: input/hotkeys name column bolded and colored for increased visual distinction - bsnes: added save button to state manager
This commit is contained in:
@@ -10,6 +10,11 @@ GtkSelectionData* data, unsigned type, unsigned timestamp, pCanvas* p) -> void {
|
||||
p->self().doDrop(paths);
|
||||
}
|
||||
|
||||
static auto Canvas_draw(GtkWidget* widget, cairo_t* context, pCanvas* p) -> signed {
|
||||
p->_onDraw(context);
|
||||
return true;
|
||||
}
|
||||
|
||||
static auto Canvas_expose(GtkWidget* widget, GdkEventExpose* event, pCanvas* p) -> signed {
|
||||
p->_onExpose(event);
|
||||
return true;
|
||||
@@ -59,7 +64,11 @@ auto pCanvas::construct() -> void {
|
||||
g_signal_connect(G_OBJECT(gtkWidget), "button-press-event", G_CALLBACK(Canvas_mousePress), (gpointer)this);
|
||||
g_signal_connect(G_OBJECT(gtkWidget), "button-release-event", G_CALLBACK(Canvas_mouseRelease), (gpointer)this);
|
||||
g_signal_connect(G_OBJECT(gtkWidget), "drag-data-received", G_CALLBACK(Canvas_drop), (gpointer)this);
|
||||
#if HIRO_GTK==2
|
||||
g_signal_connect(G_OBJECT(gtkWidget), "expose-event", G_CALLBACK(Canvas_expose), (gpointer)this);
|
||||
#elif HIRO_GTK==3
|
||||
g_signal_connect(G_OBJECT(gtkWidget), "draw", G_CALLBACK(Canvas_draw), (gpointer)this);
|
||||
#endif
|
||||
g_signal_connect(G_OBJECT(gtkWidget), "leave-notify-event", G_CALLBACK(Canvas_mouseLeave), (gpointer)this);
|
||||
g_signal_connect(G_OBJECT(gtkWidget), "motion-notify-event", G_CALLBACK(Canvas_mouseMove), (gpointer)this);
|
||||
|
||||
@@ -106,7 +115,36 @@ auto pCanvas::update() -> void {
|
||||
_redraw();
|
||||
}
|
||||
|
||||
auto pCanvas::_onDraw(cairo_t* context) -> void {
|
||||
#if HIRO_GTK==3
|
||||
int sx = 0, sy = 0, dx = 0, dy = 0;
|
||||
int width = surfaceWidth, height = surfaceHeight;
|
||||
auto geometry = pSizable::state().geometry;
|
||||
|
||||
if(width <= geometry.width()) {
|
||||
sx = 0;
|
||||
dx = (geometry.width() - width) / 2;
|
||||
} else {
|
||||
sx = (width - geometry.width()) / 2;
|
||||
dx = 0;
|
||||
}
|
||||
|
||||
if(height <= geometry.height()) {
|
||||
sy = 0;
|
||||
dy = (geometry.height() - height) / 2;
|
||||
} else {
|
||||
sy = (height - geometry.height()) / 2;
|
||||
dy = 0;
|
||||
}
|
||||
|
||||
//TODO: support non-zero sx,sy
|
||||
gdk_cairo_set_source_pixbuf(context, surface, dx, dy);
|
||||
cairo_paint(context);
|
||||
#endif
|
||||
}
|
||||
|
||||
auto pCanvas::_onExpose(GdkEventExpose* expose) -> void {
|
||||
#if HIRO_GTK==2
|
||||
if(surface == nullptr) return;
|
||||
|
||||
int sx = 0, sy = 0, dx = 0, dy = 0;
|
||||
@@ -132,10 +170,7 @@ auto pCanvas::_onExpose(GdkEventExpose* expose) -> void {
|
||||
height = geometry.height();
|
||||
}
|
||||
|
||||
#if HIRO_GTK==2
|
||||
gdk_draw_pixbuf(gtk_widget_get_window(gtkWidget), nullptr, surface, sx, sy, dx, dy, width, height, GDK_RGB_DITHER_NONE, 0, 0);
|
||||
#elif HIRO_GTK==3
|
||||
//TODO: use cairo here, but how? no examples show to use sx, sy
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -13,6 +13,7 @@ struct pCanvas : pWidget {
|
||||
auto setIcon(const image& icon) -> void;
|
||||
auto update() -> void;
|
||||
|
||||
auto _onDraw(cairo_t* context) -> void;
|
||||
auto _onExpose(GdkEventExpose* event) -> void;
|
||||
auto _rasterize() -> void;
|
||||
auto _redraw() -> void;
|
||||
|
@@ -10,6 +10,10 @@ GtkSelectionData* data, unsigned type, unsigned timestamp, pViewport* p) -> void
|
||||
p->self().doDrop(paths);
|
||||
}
|
||||
|
||||
static auto Viewport_draw(GtkWidget* widget, cairo_t* context, pViewport* p) -> signed {
|
||||
return true;
|
||||
}
|
||||
|
||||
static auto Viewport_expose(GtkWidget* widget, GdkEventExpose* event) -> signed {
|
||||
return true;
|
||||
}
|
||||
@@ -59,7 +63,11 @@ auto pViewport::construct() -> void {
|
||||
g_signal_connect(G_OBJECT(gtkWidget), "button-press-event", G_CALLBACK(Viewport_mousePress), (gpointer)this);
|
||||
g_signal_connect(G_OBJECT(gtkWidget), "button-release-event", G_CALLBACK(Viewport_mouseRelease), (gpointer)this);
|
||||
g_signal_connect(G_OBJECT(gtkWidget), "drag-data-received", G_CALLBACK(Viewport_dropEvent), (gpointer)this);
|
||||
#if HIRO_GTK==2
|
||||
g_signal_connect(G_OBJECT(gtkWidget), "expose-event", G_CALLBACK(Viewport_expose), (gpointer)this);
|
||||
#elif HIRO_GTK==3
|
||||
g_signal_connect(G_OBJECT(gtkWidget), "draw", G_CALLBACK(Viewport_draw), (gpointer)this);
|
||||
#endif
|
||||
g_signal_connect(G_OBJECT(gtkWidget), "leave-notify-event", G_CALLBACK(Viewport_mouseLeave), (gpointer)this);
|
||||
g_signal_connect(G_OBJECT(gtkWidget), "motion-notify-event", G_CALLBACK(Viewport_mouseMove), (gpointer)this);
|
||||
|
||||
|
@@ -30,7 +30,6 @@ static auto Window_draw(GtkWidget* widget, cairo_t* context, pWindow* p) -> sign
|
||||
|
||||
cairo_set_operator(context, CAIRO_OPERATOR_SOURCE);
|
||||
cairo_paint(context);
|
||||
cairo_destroy(context);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -39,7 +38,8 @@ static auto Window_draw(GtkWidget* widget, cairo_t* context, pWindow* p) -> sign
|
||||
static auto Window_expose(GtkWidget* widget, GdkEvent* event, pWindow* p) -> signed {
|
||||
if(auto color = p->state().backgroundColor) {
|
||||
cairo_t* context = gdk_cairo_create(gtk_widget_get_window(widget));
|
||||
return Window_draw(widget, context, p);
|
||||
Window_draw(widget, context, p);
|
||||
cairo_destroy(context);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user