parent
fe5a6f06ce
commit
37d5bdf016
@ -1,2 +1 @@
|
||||
67844da5ed54c1a09d8d4ebe32a5e00a wxWidgets-3.0.2-docs-html.tar.bz2
|
||||
ba4cd1f3853d0cd49134c5ae028ad080 wxWidgets-3.0.2.tar.bz2
|
||||
f1b6f528f6dc5d3a83d1d484b08a35f9 wxWidgets-9518d52.tar.gz
|
||||
|
@ -1,32 +0,0 @@
|
||||
From 553ec7537c30636ddf6cbc157373477fb2e9da41 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Cornett <paulcor@users.noreply.github.com>
|
||||
Date: Wed, 9 Nov 2016 20:06:26 -0800
|
||||
Subject: [PATCH] Fix non-default window background color with GTK+ >= 3.20
|
||||
|
||||
GTK+ no longer automatically paints non-default window background. See #17586
|
||||
|
||||
(cherry picked from commit 9bb5d0435a4cce5bcb7b3956cb730f59c37ea5f6)
|
||||
---
|
||||
src/gtk/window.cpp | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp
|
||||
index 0826e06..bca5443 100644
|
||||
--- a/src/gtk/window.cpp
|
||||
+++ b/src/gtk/window.cpp
|
||||
@@ -4238,6 +4238,15 @@ void wxWindowGTK::GTKSendPaintEvents(const GdkRegion* region)
|
||||
0, 0, w, h);
|
||||
#endif // !__WXGTK3__
|
||||
}
|
||||
+#ifdef __WXGTK3__
|
||||
+ else if (m_backgroundColour.IsOk() && gtk_check_version(3,20,0) == NULL)
|
||||
+ {
|
||||
+ cairo_save(cr);
|
||||
+ gdk_cairo_set_source_rgba(cr, m_backgroundColour);
|
||||
+ cairo_paint(cr);
|
||||
+ cairo_restore(cr);
|
||||
+ }
|
||||
+#endif
|
||||
break;
|
||||
|
||||
case wxBG_STYLE_PAINT:
|
@ -1,38 +0,0 @@
|
||||
diff -rupN wxWidgets-3.0.2-orig/src/gtk/renderer.cpp wxWidgets-3.0.2/src/gtk/renderer.cpp
|
||||
--- wxWidgets-3.0.2-orig/src/gtk/renderer.cpp 2015-11-05 19:57:31.075151404 -0500
|
||||
+++ wxWidgets-3.0.2/src/gtk/renderer.cpp 2015-11-05 20:37:56.230764763 -0500
|
||||
@@ -41,6 +41,10 @@
|
||||
#include "wx/gtk/private.h"
|
||||
#include "wx/gtk/private/gtk2-compat.h"
|
||||
|
||||
+#if defined(__WXGTK3__) && !GTK_CHECK_VERSION(3,14,0)
|
||||
+ #define GTK_STATE_FLAG_CHECKED (1 << 11)
|
||||
+#endif
|
||||
+
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxRendererGTK: our wxRendererNative implementation
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -551,7 +555,11 @@ wxRendererGTK::DrawCheckBox(wxWindow* wi
|
||||
{
|
||||
int stateFlags = GTK_STATE_FLAG_NORMAL;
|
||||
if (flags & wxCONTROL_CHECKED)
|
||||
+ {
|
||||
stateFlags = GTK_STATE_FLAG_ACTIVE;
|
||||
+ if (gtk_check_version(3,14,0) == NULL)
|
||||
+ stateFlags = GTK_STATE_FLAG_CHECKED;
|
||||
+ }
|
||||
if (flags & wxCONTROL_DISABLED)
|
||||
stateFlags |= GTK_STATE_FLAG_INSENSITIVE;
|
||||
if (flags & wxCONTROL_UNDETERMINED)
|
||||
@@ -866,7 +874,11 @@ void wxRendererGTK::DrawRadioBitmap(wxWi
|
||||
#ifdef __WXGTK3__
|
||||
int state = GTK_STATE_FLAG_NORMAL;
|
||||
if (flags & wxCONTROL_CHECKED)
|
||||
+ {
|
||||
state = GTK_STATE_FLAG_ACTIVE;
|
||||
+ if (gtk_check_version(3,14,0) == NULL)
|
||||
+ state = GTK_STATE_FLAG_CHECKED;
|
||||
+ }
|
||||
else if (flags & wxCONTROL_UNDETERMINED)
|
||||
state = GTK_STATE_FLAG_INCONSISTENT;
|
||||
if (flags & wxCONTROL_DISABLED)
|
@ -1,38 +0,0 @@
|
||||
From 148971013ee48926dfe153ca39c94be92acde37c Mon Sep 17 00:00:00 2001
|
||||
From: Paul Cornett <paulcor@bullseye.com>
|
||||
Date: Wed, 15 Oct 2014 16:53:54 +0000
|
||||
Subject: [PATCH] fix crash in wxGCDC::DrawEllipticArc() after r76954, closes
|
||||
#16623
|
||||
|
||||
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@78023 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
|
||||
---
|
||||
src/common/dcgraph.cpp | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/common/dcgraph.cpp b/src/common/dcgraph.cpp
|
||||
index d27e9cc..c390eb4 100644
|
||||
--- a/src/common/dcgraph.cpp
|
||||
+++ b/src/common/dcgraph.cpp
|
||||
@@ -646,13 +646,12 @@ void wxGCDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h,
|
||||
m_graphicContext->PushState();
|
||||
m_graphicContext->Translate(dx, dy);
|
||||
m_graphicContext->Scale(factor, 1.0);
|
||||
- wxGraphicsPath path;
|
||||
+ wxGraphicsPath path = m_graphicContext->CreatePath();
|
||||
|
||||
// since these angles (ea,sa) are measured counter-clockwise, we invert them to
|
||||
// get clockwise angles
|
||||
if ( m_brush.GetStyle() != wxTRANSPARENT )
|
||||
{
|
||||
- path = m_graphicContext->CreatePath();
|
||||
path.MoveToPoint( 0, 0 );
|
||||
path.AddArc( 0, 0, h/2.0 , DegToRad(-sa) , DegToRad(-ea), sa > ea );
|
||||
path.AddLineToPoint( 0, 0 );
|
||||
@@ -664,7 +663,6 @@ void wxGCDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h,
|
||||
}
|
||||
else
|
||||
{
|
||||
- wxGraphicsPath path = m_graphicContext->CreatePath();
|
||||
path.AddArc( 0, 0, h/2.0 , DegToRad(-sa) , DegToRad(-ea), sa > ea );
|
||||
m_graphicContext->DrawPath( path );
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
commit 8f29de5231e348d356b5f3962225362e8fd87ba9
|
||||
Author: Tim Kosse <tim.kosse@filezilla-project.org>
|
||||
Date: Mon Sep 14 11:42:38 2015 +0200
|
||||
|
||||
Escape filenames in wxFileDataObject::GetDataSize/GetDataHere
|
||||
|
||||
On wxGTK, wxFileDataObject::SetData calls g_filename_from_uri which
|
||||
percent-decodes URIs. No corresponding percent-encoding was done in
|
||||
wxFileDataObject::GetDataSize/GetDataHere. Use g_filename_to_uri instead in so
|
||||
that filenames are properly escaped.
|
||||
|
||||
This commit also fixes the data being truncated if it contains non-ASCII
|
||||
characters on wide-character builds, see the memcpy arguments in the original
|
||||
code.
|
||||
|
||||
diff --git a/src/gtk/dataobj.cpp b/src/gtk/dataobj.cpp
|
||||
index 9a39607..2d1f43c 100644
|
||||
--- a/src/gtk/dataobj.cpp
|
||||
+++ b/src/gtk/dataobj.cpp
|
||||
@@ -235,16 +235,21 @@ wxTextDataObject::GetAllFormats(wxDataFormat *formats,
|
||||
|
||||
bool wxFileDataObject::GetDataHere(void *buf) const
|
||||
{
|
||||
- wxString filenames;
|
||||
+ char* out = reinterpret_cast<char*>(buf);
|
||||
|
||||
for (size_t i = 0; i < m_filenames.GetCount(); i++)
|
||||
{
|
||||
- filenames += wxT("file:");
|
||||
- filenames += m_filenames[i];
|
||||
- filenames += wxT("\r\n");
|
||||
+ char* uri = g_filename_to_uri(m_filenames[i].mbc_str(), 0, 0);
|
||||
+ if (uri)
|
||||
+ {
|
||||
+ size_t const len = strlen(uri);
|
||||
+ strcpy(out, uri);
|
||||
+ out += len;
|
||||
+ *(out++) = '\r';
|
||||
+ *(out++) = '\n';
|
||||
+ }
|
||||
}
|
||||
-
|
||||
- memcpy( buf, filenames.mbc_str(), filenames.length() + 1 );
|
||||
+ *out = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -255,9 +260,11 @@ size_t wxFileDataObject::GetDataSize() const
|
||||
|
||||
for (size_t i = 0; i < m_filenames.GetCount(); i++)
|
||||
{
|
||||
- // This is junk in UTF-8
|
||||
- res += m_filenames[i].length();
|
||||
- res += 5 + 2; // "file:" (5) + "\r\n" (2)
|
||||
+ char* uri = g_filename_to_uri(m_filenames[i].mbc_str(), 0, 0);
|
||||
+ if (uri) {
|
||||
+ res += strlen(uri) + 2; // Including "\r\n"
|
||||
+ g_free(uri);
|
||||
+ }
|
||||
}
|
||||
|
||||
return res + 1;
|
@ -1,35 +0,0 @@
|
||||
commit 0f9f942a5bbe0ed9f07ea2e1fef90a7e2db768e5
|
||||
Author: Paul Cornett <paulcor@users.noreply.github.com>
|
||||
Date: Fri Oct 2 09:14:06 2015 -0700
|
||||
|
||||
Fix memory leak introduced in 8f29de52
|
||||
|
||||
Also, use memcpy() instead of strcpy() since we already have the length,
|
||||
and use static_cast instead of reinterpret_cast.
|
||||
|
||||
diff --git a/src/gtk/dataobj.cpp b/src/gtk/dataobj.cpp
|
||||
index 2d1f43c..df460d8 100644
|
||||
--- a/src/gtk/dataobj.cpp
|
||||
+++ b/src/gtk/dataobj.cpp
|
||||
@@ -235,7 +235,7 @@ wxTextDataObject::GetAllFormats(wxDataFormat *formats,
|
||||
|
||||
bool wxFileDataObject::GetDataHere(void *buf) const
|
||||
{
|
||||
- char* out = reinterpret_cast<char*>(buf);
|
||||
+ char* out = static_cast<char*>(buf);
|
||||
|
||||
for (size_t i = 0; i < m_filenames.GetCount(); i++)
|
||||
{
|
||||
@@ -243,10 +243,11 @@ bool wxFileDataObject::GetDataHere(void *buf) const
|
||||
if (uri)
|
||||
{
|
||||
size_t const len = strlen(uri);
|
||||
- strcpy(out, uri);
|
||||
+ memcpy(out, uri, len);
|
||||
out += len;
|
||||
*(out++) = '\r';
|
||||
*(out++) = '\n';
|
||||
+ g_free(uri);
|
||||
}
|
||||
}
|
||||
*out = 0;
|
@ -1,47 +0,0 @@
|
||||
From a19e512e80acdb2a777c3e44923ad0b1178db35a Mon Sep 17 00:00:00 2001
|
||||
From: Scott Talbert <swt@techie.net>
|
||||
Date: Sun, 7 Aug 2016 23:15:41 -0400
|
||||
Subject: [PATCH] Fix the stop function of wxFontEnumerator for wxGTK
|
||||
|
||||
In a wxFontEnumerator, if false is returned from OnFacename() or
|
||||
OnFontEncoding(), the enumeration is supposed to stop. This was not happening
|
||||
on wxGTK.
|
||||
|
||||
See https://github.com/wxWidgets/wxWidgets/pull/311
|
||||
|
||||
(cherry picked from commit 3572c2c6548bca2dbd439a3d25ed403fda99ebe9)
|
||||
---
|
||||
src/common/fontenumcmn.cpp | 3 ++-
|
||||
src/unix/fontenum.cpp | 5 ++++-
|
||||
2 files changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/common/fontenumcmn.cpp b/src/common/fontenumcmn.cpp
|
||||
index 1185a86..f0d6f68 100644
|
||||
--- a/src/common/fontenumcmn.cpp
|
||||
+++ b/src/common/fontenumcmn.cpp
|
||||
@@ -124,7 +124,8 @@ bool wxFontEnumerator::EnumerateEncodingsUTF8(const wxString& facename)
|
||||
|
||||
for ( size_t n = 0; n < count; n++ )
|
||||
{
|
||||
- OnFontEncoding(facenames[n], utf8);
|
||||
+ if ( !OnFontEncoding(facenames[n], utf8) )
|
||||
+ break;
|
||||
}
|
||||
|
||||
return true;
|
||||
diff --git a/src/unix/fontenum.cpp b/src/unix/fontenum.cpp
|
||||
index cc7ee1d..e3739ed 100644
|
||||
--- a/src/unix/fontenum.cpp
|
||||
+++ b/src/unix/fontenum.cpp
|
||||
@@ -89,7 +89,10 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
|
||||
#endif
|
||||
{
|
||||
const gchar *name = pango_font_family_get_name(families[i]);
|
||||
- OnFacename(wxString(name, wxConvUTF8));
|
||||
+ if ( !OnFacename(wxString(name, wxConvUTF8)) )
|
||||
+ {
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
g_free(families);
|
@ -1,29 +0,0 @@
|
||||
From 2bc3721f065fd7d47674ccaf7e8d9d6cc195aab5 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Cornett <paulcor@users.noreply.github.com>
|
||||
Date: Sat, 6 Feb 2016 08:58:53 -0800
|
||||
Subject: [PATCH] Fix GetBestSize() for GTK3 after size has been set
|
||||
|
||||
Need to reset size request to get actual best size.
|
||||
See Fedora bug https://bugzilla.redhat.com/show_bug.cgi?id=1282142
|
||||
|
||||
(cherry picked from commit 6ed7e27bf270f9f7767b59ebaa9a7f37c5bb3bed)
|
||||
---
|
||||
src/gtk/control.cpp | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/gtk/control.cpp b/src/gtk/control.cpp
|
||||
index 3352965..20cd746 100644
|
||||
--- a/src/gtk/control.cpp
|
||||
+++ b/src/gtk/control.cpp
|
||||
@@ -319,7 +319,11 @@ wxSize wxControl::GTKGetPreferredSize(GtkWidget* widget) const
|
||||
{
|
||||
GtkRequisition req;
|
||||
#ifdef __WXGTK3__
|
||||
+ int w, h;
|
||||
+ gtk_widget_get_size_request(widget, &w, &h);
|
||||
+ gtk_widget_set_size_request(widget, -1, -1);
|
||||
gtk_widget_get_preferred_size(widget, NULL, &req);
|
||||
+ gtk_widget_set_size_request(widget, w, h);
|
||||
#else
|
||||
GTK_WIDGET_GET_CLASS(widget)->size_request(widget, &req);
|
||||
#endif
|
@ -1,48 +0,0 @@
|
||||
From 2dd407609b8987634180c045e9a6d131db6f947e Mon Sep 17 00:00:00 2001
|
||||
From: Paul Cornett <paulcor@users.noreply.github.com>
|
||||
Date: Mon, 17 Aug 2015 21:54:41 -0700
|
||||
Subject: [PATCH] use gtk_show_uri() in wxLaunchDefaultBrowser() implementation
|
||||
for GTK+
|
||||
|
||||
(cherry picked from commit 22eec388068044b9ea3c9fd1539d6686574a32df)
|
||||
---
|
||||
src/unix/utilsx11.cpp | 16 +++++++++++++++-
|
||||
1 file changed, 15 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/unix/utilsx11.cpp b/src/unix/utilsx11.cpp
|
||||
index 12ff73e..7d5811a 100644
|
||||
--- a/src/unix/utilsx11.cpp
|
||||
+++ b/src/unix/utilsx11.cpp
|
||||
@@ -36,10 +36,11 @@
|
||||
#endif
|
||||
|
||||
#ifdef __WXGTK__
|
||||
-#include <gdk/gdk.h>
|
||||
+#include <gtk/gtk.h>
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
#include <gdk/gdkx.h>
|
||||
#endif
|
||||
+GdkWindow* wxGetTopLevelGDK();
|
||||
#endif
|
||||
|
||||
// Only X11 backend is supported for wxGTK here
|
||||
@@ -887,6 +888,19 @@ bool wxDoLaunchDefaultBrowser(const wxString& url, int flags)
|
||||
{
|
||||
wxUnusedVar(flags);
|
||||
|
||||
+#ifdef __WXGTK__
|
||||
+#if GTK_CHECK_VERSION(2,14,0)
|
||||
+#ifndef __WXGTK3__
|
||||
+ if (gtk_check_version(2,14,0) == NULL)
|
||||
+#endif
|
||||
+ {
|
||||
+ GdkScreen* screen = gdk_window_get_screen(wxGetTopLevelGDK());
|
||||
+ if (gtk_show_uri(screen, url.utf8_str(), GDK_CURRENT_TIME, NULL))
|
||||
+ return true;
|
||||
+ }
|
||||
+#endif // GTK_CHECK_VERSION(2,14,0)
|
||||
+#endif // __WXGTK__
|
||||
+
|
||||
// Our best best is to use xdg-open from freedesktop.org cross-desktop
|
||||
// compatibility suite xdg-utils
|
||||
// (see http://portland.freedesktop.org/wiki/) -- this is installed on
|
@ -1,27 +0,0 @@
|
||||
From 79676e1e9d307c479c5aefa70c0fd052341d697e Mon Sep 17 00:00:00 2001
|
||||
From: Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
Date: Mon, 24 Aug 2015 17:18:15 +0200
|
||||
Subject: [PATCH] Fix wxGTK build after wxLaunchDefaultBrowser() fix backport.
|
||||
|
||||
2dd407609b8987634180c045e9a6d131db6f947e uses wxGetTopLevelGDK() only
|
||||
available in master and not in 3.0 branch, avoid it by just using the default
|
||||
screen (which also avoids having to add another GTK+ version check for
|
||||
gdk_window_get_screen() which is only available since 2.24).
|
||||
---
|
||||
src/unix/utilsx11.cpp | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/unix/utilsx11.cpp b/src/unix/utilsx11.cpp
|
||||
index 7d5811a..6b35551 100644
|
||||
--- a/src/unix/utilsx11.cpp
|
||||
+++ b/src/unix/utilsx11.cpp
|
||||
@@ -894,8 +894,7 @@ bool wxDoLaunchDefaultBrowser(const wxString& url, int flags)
|
||||
if (gtk_check_version(2,14,0) == NULL)
|
||||
#endif
|
||||
{
|
||||
- GdkScreen* screen = gdk_window_get_screen(wxGetTopLevelGDK());
|
||||
- if (gtk_show_uri(screen, url.utf8_str(), GDK_CURRENT_TIME, NULL))
|
||||
+ if (gtk_show_uri(NULL, url.utf8_str(), GDK_CURRENT_TIME, NULL))
|
||||
return true;
|
||||
}
|
||||
#endif // GTK_CHECK_VERSION(2,14,0)
|
@ -1,166 +0,0 @@
|
||||
From 6475376931bf316a4fd791114408f7c1fc2fe836 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Cornett <paulcor@users.noreply.github.com>
|
||||
Date: Wed, 2 Nov 2016 10:30:44 -0700
|
||||
Subject: [PATCH] Fix some sizing problems with GTK3
|
||||
|
||||
A change in size-allocate handling with GTK+ 3.20 exposed a flaw in our method for
|
||||
deferring queue-resize requests. Using an idle callback to process the requests
|
||||
did not work well with the GdkFrameClock-based system used since GTK+ 3.8. Using
|
||||
the "check-resize" signal works better. Also with GTK+ >= 3.20, it seems necessary
|
||||
to manually work the queue-resize up to the TLW, as otherwise the resized widgets
|
||||
don't get updated without an external size-allocate event.
|
||||
See #17585
|
||||
|
||||
(backport of 3b4ee5a031b1c2fa29772b90751a82dd7f1d3de0)
|
||||
---
|
||||
src/gtk/window.cpp | 102 +++++++++++++++++++++++++++++++++++++++--------------
|
||||
1 file changed, 76 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp
|
||||
index d27f889..ab56baa 100644
|
||||
--- a/src/gtk/window.cpp
|
||||
+++ b/src/gtk/window.cpp
|
||||
@@ -221,6 +221,8 @@ int g_lastButtonNumber = 0;
|
||||
|
||||
#ifdef __WXGTK3__
|
||||
static GList* gs_sizeRevalidateList;
|
||||
+static GSList* gs_queueResizeList;
|
||||
+static bool gs_inSizeAllocate;
|
||||
void wxGTKSizeRevalidate(wxWindow*);
|
||||
#endif
|
||||
|
||||
@@ -2083,6 +2085,54 @@ static void frame_clock_layout(GdkFrameClock*, wxWindow* win)
|
||||
}
|
||||
#endif // GTK_CHECK_VERSION(3,8,0)
|
||||
|
||||
+#ifdef __WXGTK3__
|
||||
+//-----------------------------------------------------------------------------
|
||||
+// "check-resize"
|
||||
+//-----------------------------------------------------------------------------
|
||||
+
|
||||
+static void check_resize(GtkContainer*, wxWindow*)
|
||||
+{
|
||||
+ gs_inSizeAllocate = true;
|
||||
+}
|
||||
+
|
||||
+static void check_resize_after(GtkContainer*, wxWindow*)
|
||||
+{
|
||||
+ gs_inSizeAllocate = false;
|
||||
+ if (gs_queueResizeList)
|
||||
+ {
|
||||
+ for (GSList* p = gs_queueResizeList; p; p = p->next)
|
||||
+ {
|
||||
+ if (p->data == NULL)
|
||||
+ continue;
|
||||
+
|
||||
+ wxWindowGTK* w = static_cast<wxWindowGTK*>(p->data);
|
||||
+ g_object_remove_weak_pointer(G_OBJECT(w->m_widget), &p->data);
|
||||
+ gtk_widget_set_size_request(w->m_widget, w->m_width, w->m_height);
|
||||
+
|
||||
+ // in case only the position is changing
|
||||
+ gtk_widget_queue_resize(w->m_widget);
|
||||
+
|
||||
+ // need to force the queue-resize up to the TLW with GTK >= 3.20
|
||||
+ if (gtk_check_version(3,20,0) == NULL)
|
||||
+ {
|
||||
+ GtkWidget* widget = w->m_widget;
|
||||
+ for (;;)
|
||||
+ {
|
||||
+ widget = gtk_widget_get_parent(widget);
|
||||
+ if (widget == NULL)
|
||||
+ break;
|
||||
+ gtk_widget_queue_resize(widget);
|
||||
+ if (gtk_widget_is_toplevel(widget))
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ g_slist_free(gs_queueResizeList);
|
||||
+ gs_queueResizeList = NULL;
|
||||
+ }
|
||||
+}
|
||||
+#endif // __WXGTK3__
|
||||
+
|
||||
} // extern "C"
|
||||
|
||||
void wxWindowGTK::GTKHandleRealized()
|
||||
@@ -2670,6 +2720,13 @@ void wxWindowGTK::PostCreation()
|
||||
g_signal_connect(m_wxwindow ? m_wxwindow : m_widget, "size_allocate",
|
||||
G_CALLBACK(size_allocate), this);
|
||||
}
|
||||
+#ifdef __WXGTK3__
|
||||
+ else
|
||||
+ {
|
||||
+ g_signal_connect(m_widget, "check-resize", G_CALLBACK(check_resize), this);
|
||||
+ g_signal_connect_after(m_widget, "check-resize", G_CALLBACK(check_resize_after), this);
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2, 8, 0)
|
||||
#ifndef __WXGTK3__
|
||||
@@ -2778,46 +2835,39 @@ void wxWindowGTK::ConnectWidget( GtkWidget *widget )
|
||||
G_CALLBACK (gtk_window_leave_callback), this);
|
||||
}
|
||||
|
||||
-static GSList* gs_queueResizeList;
|
||||
-
|
||||
-extern "C" {
|
||||
-static gboolean queue_resize(void*)
|
||||
-{
|
||||
- gdk_threads_enter();
|
||||
- for (GSList* p = gs_queueResizeList; p; p = p->next)
|
||||
- {
|
||||
- if (p->data)
|
||||
- {
|
||||
- gtk_widget_queue_resize(GTK_WIDGET(p->data));
|
||||
- g_object_remove_weak_pointer(G_OBJECT(p->data), &p->data);
|
||||
- }
|
||||
- }
|
||||
- g_slist_free(gs_queueResizeList);
|
||||
- gs_queueResizeList = NULL;
|
||||
- gdk_threads_leave();
|
||||
- return false;
|
||||
-}
|
||||
-}
|
||||
-
|
||||
void wxWindowGTK::DoMoveWindow(int x, int y, int width, int height)
|
||||
{
|
||||
- gtk_widget_set_size_request(m_widget, width, height);
|
||||
GtkWidget* parent = gtk_widget_get_parent(m_widget);
|
||||
if (WX_IS_PIZZA(parent))
|
||||
+ {
|
||||
WX_PIZZA(parent)->move(m_widget, x, y, width, height);
|
||||
+ if (
|
||||
+#ifdef __WXGTK3__
|
||||
+ !gs_inSizeAllocate &&
|
||||
+#endif
|
||||
+ gtk_widget_get_visible(m_widget))
|
||||
+ {
|
||||
+ // in case only the position is changing
|
||||
+ gtk_widget_queue_resize(m_widget);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
+#ifdef __WXGTK3__
|
||||
// With GTK3, gtk_widget_queue_resize() is ignored while a size-allocate
|
||||
// is in progress. This situation is common in wxWidgets, since
|
||||
// size-allocate can generate wxSizeEvent and size event handlers often
|
||||
// call SetSize(), directly or indirectly. Work around this by deferring
|
||||
// the queue-resize until after size-allocate processing is finished.
|
||||
- if (g_slist_find(gs_queueResizeList, m_widget) == NULL)
|
||||
+ if (!gs_inSizeAllocate || !gtk_widget_get_visible(m_widget))
|
||||
+ gtk_widget_set_size_request(m_widget, width, height);
|
||||
+ else
|
||||
{
|
||||
- if (gs_queueResizeList == NULL)
|
||||
- g_idle_add_full(GTK_PRIORITY_RESIZE, queue_resize, NULL, NULL);
|
||||
- gs_queueResizeList = g_slist_prepend(gs_queueResizeList, m_widget);
|
||||
+ gs_queueResizeList = g_slist_prepend(gs_queueResizeList, this);
|
||||
g_object_add_weak_pointer(G_OBJECT(m_widget), &gs_queueResizeList->data);
|
||||
}
|
||||
+#else // !__WXGTK3__
|
||||
+ gtk_widget_set_size_request(m_widget, width, height);
|
||||
+#endif // !__WXGTK3__
|
||||
}
|
||||
|
||||
void wxWindowGTK::ConstrainSize()
|
@ -1,39 +0,0 @@
|
||||
From 238a948ed01f27e05e2c0e08932e8da207590648 Mon Sep 17 00:00:00 2001
|
||||
From: Scott Talbert <swt@techie.net>
|
||||
Date: Tue, 9 Aug 2016 21:12:58 -0400
|
||||
Subject: [PATCH] Fix wxNativeFontInfo::InitFromFont() when using Pango
|
||||
|
||||
Use pango_font_description_copy() to make a lossless copy of the original font
|
||||
instead of doing it using wxWidgets API which is less direct and, in addition,
|
||||
currently is completely broken as SetXXX() methods don't create the Pango font
|
||||
description if it doesn't exist as they ought to.
|
||||
|
||||
See https://github.com/wxWidgets/wxWidgets/pull/312
|
||||
|
||||
(cherry picked from commit dbe2a1c2fdba53ad1d08ce36780267217933a876)
|
||||
---
|
||||
include/wx/fontutil.h | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/include/wx/fontutil.h b/include/wx/fontutil.h
|
||||
index 60bb874..9e4d023 100644
|
||||
--- a/include/wx/fontutil.h
|
||||
+++ b/include/wx/fontutil.h
|
||||
@@ -227,6 +227,9 @@ public :
|
||||
// init with the parameters of the given font
|
||||
void InitFromFont(const wxFont& font)
|
||||
{
|
||||
+#if wxUSE_PANGO
|
||||
+ Init(*font.GetNativeFontInfo());
|
||||
+#else
|
||||
// translate all font parameters
|
||||
SetStyle((wxFontStyle)font.GetStyle());
|
||||
SetWeight((wxFontWeight)font.GetWeight());
|
||||
@@ -252,6 +255,7 @@ public :
|
||||
// deal with encoding now (it may override the font family and facename
|
||||
// so do it after setting them)
|
||||
SetEncoding(font.GetEncoding());
|
||||
+#endif // !wxUSE_PANGO
|
||||
}
|
||||
|
||||
// accessors and modifiers for the font elements
|
@ -1,54 +0,0 @@
|
||||
From 03903c1e459f108e0c464db24064e4cde84f174a Mon Sep 17 00:00:00 2001
|
||||
From: Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
Date: Fri, 20 Dec 2013 17:50:27 +0000
|
||||
Subject: [PATCH] Document wxEVT_MEDIA_XXX event types.
|
||||
|
||||
See #15768.
|
||||
|
||||
(cherry picked from commit 5c1f95bc71028e4562f847af56b815b2f13370a9 on master)
|
||||
---
|
||||
interface/wx/mediactrl.h | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/interface/wx/mediactrl.h b/interface/wx/mediactrl.h
|
||||
index e425fa0..8bcfada 100644
|
||||
--- a/interface/wx/mediactrl.h
|
||||
+++ b/interface/wx/mediactrl.h
|
||||
@@ -48,6 +48,7 @@ enum wxMediaCtrlPlayerControls
|
||||
@beginEventTable{wxMediaEvent}
|
||||
@event{EVT_MEDIA_LOADED(id\, func)}
|
||||
Sent when a media has loaded enough data that it can start playing.
|
||||
+ Processes a @c wxEVT_MEDIA_LOADED event type.
|
||||
@event{EVT_MEDIA_STOP(id\, func)}
|
||||
Sent when a media has switched to the @c wxMEDIASTATE_STOPPED state.
|
||||
You may be able to Veto this event to prevent it from stopping,
|
||||
@@ -55,14 +56,19 @@ enum wxMediaCtrlPlayerControls
|
||||
the media (note that this may not have the desired effect - if you
|
||||
want to loop the media, for example, catch the @c EVT_MEDIA_FINISHED
|
||||
and play there instead).
|
||||
+ Processes a @c wxEVT_MEDIA_STOP event type.
|
||||
@event{EVT_MEDIA_FINISHED(id\, func)}
|
||||
Sent when a media has finished playing in a wxMediaCtrl.
|
||||
+ Processes a @c wxEVT_MEDIA_FINISHED event type.
|
||||
@event{EVT_MEDIA_STATECHANGED(id\, func)}
|
||||
Sent when a media has switched its state (from any media state).
|
||||
+ Processes a @c wxEVT_MEDIA_STATECHANGED event type.
|
||||
@event{EVT_MEDIA_PLAY(id\, func)}
|
||||
Sent when a media has switched to the @c wxMEDIASTATE_PLAYING state.
|
||||
+ Processes a @c wxEVT_MEDIA_PLAY event type.
|
||||
@event{EVT_MEDIA_PAUSE(id\, func)}
|
||||
Sent when a media has switched to the @c wxMEDIASTATE_PAUSED state.
|
||||
+ Processes a @c wxEVT_MEDIA_PAUSE event type.
|
||||
@endEventTable
|
||||
|
||||
@library{wxmedia}
|
||||
@@ -442,3 +448,9 @@ class wxMediaCtrl : public wxControl
|
||||
wxFileOffset Tell();
|
||||
};
|
||||
|
||||
+wxEventType wxEVT_MEDIA_LOADED;
|
||||
+wxEventType wxEVT_MEDIA_STOP;
|
||||
+wxEventType wxEVT_MEDIA_FINISHED;
|
||||
+wxEventType wxEVT_MEDIA_STATECHANGED;
|
||||
+wxEventType wxEVT_MEDIA_PLAY;
|
||||
+wxEventType wxEVT_MEDIA_PAUSE;
|
@ -1,40 +0,0 @@
|
||||
From cd8811bf142172c4920ba13a685472ceb405ef78 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Cornett <paulcor@users.noreply.github.com>
|
||||
Date: Thu, 3 Nov 2016 09:14:30 -0700
|
||||
Subject: [PATCH] Fix paint clipping region with GTK+ >= 3.20
|
||||
|
||||
Apparently the clip is no longer set properly. Fixes wxDC::Clear() overwriting
|
||||
areas outside the window. Problem can be seen in the Audacity toolbars.
|
||||
|
||||
(cherry picked from commit bca7313499c11a6d7fecd2baa355ac09fd3ac83b)
|
||||
---
|
||||
src/gtk/window.cpp | 14 +++++++++++++-
|
||||
1 file changed, 13 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp
|
||||
index 41fffb4..96789de 100644
|
||||
--- a/src/gtk/window.cpp
|
||||
+++ b/src/gtk/window.cpp
|
||||
@@ -4099,9 +4099,21 @@ void wxWindowGTK::GTKSendPaintEvents(const GdkRegion* region)
|
||||
#endif
|
||||
{
|
||||
#ifdef __WXGTK3__
|
||||
- m_paintContext = cr;
|
||||
+ {
|
||||
+ cairo_region_t* region = gdk_window_get_clip_region(gtk_widget_get_window(m_wxwindow));
|
||||
+ cairo_rectangle_int_t rect;
|
||||
+ cairo_region_get_extents(region, &rect);
|
||||
+ cairo_region_destroy(region);
|
||||
+ cairo_rectangle(cr, rect.x, rect.y, rect.width, rect.height);
|
||||
+ cairo_clip(cr);
|
||||
+ }
|
||||
double x1, y1, x2, y2;
|
||||
cairo_clip_extents(cr, &x1, &y1, &x2, &y2);
|
||||
+
|
||||
+ if (x1 >= x2 || y1 >= y2)
|
||||
+ return;
|
||||
+
|
||||
+ m_paintContext = cr;
|
||||
m_updateRegion = wxRegion(int(x1), int(y1), int(x2 - x1), int(y2 - y1));
|
||||
#else // !__WXGTK3__
|
||||
m_updateRegion = wxRegion(region);
|
@ -1,31 +0,0 @@
|
||||
From 8d7e0d045250fa78a7e7d5a25cecee43bb75db3a Mon Sep 17 00:00:00 2001
|
||||
From: Paul Cornett <paulcor@bullseye.com>
|
||||
Date: Mon, 10 Nov 2014 04:13:18 +0000
|
||||
Subject: [PATCH] fix infinite sizing loop with GTK3 when using a non-default
|
||||
target window, closes #16668
|
||||
|
||||
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@78106 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
|
||||
---
|
||||
docs/changes.txt | 5 +++++
|
||||
src/gtk/scrolwin.cpp | 8 ++++++++
|
||||
2 files changed, 13 insertions(+)
|
||||
|
||||
diff --git a/src/gtk/scrolwin.cpp b/src/gtk/scrolwin.cpp
|
||||
index 9b39077..c500288 100644
|
||||
--- a/src/gtk/scrolwin.cpp
|
||||
+++ b/src/gtk/scrolwin.cpp
|
||||
@@ -81,6 +81,14 @@ void wxScrollHelper::AdjustScrollbars()
|
||||
{
|
||||
int vw, vh;
|
||||
m_targetWindow->GetVirtualSize(&vw, &vh);
|
||||
+#ifdef __WXGTK3__
|
||||
+ if (m_targetWindow != m_win)
|
||||
+ {
|
||||
+ // setting wxPizza preferred size keeps GtkScrolledWindow from causing
|
||||
+ // an infinite sizing loop
|
||||
+ gtk_widget_set_size_request(m_win->m_wxwindow, vw, vh);
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
int w, h;
|
||||
const wxSize availSize = GetSizeAvailableForScrollTarget(
|
@ -1,36 +0,0 @@
|
||||
diff -up wxWidgets-3.0.2/src/gtk/win_gtk.cpp.size-alloc-fix wxWidgets-3.0.2/src/gtk/win_gtk.cpp
|
||||
--- wxWidgets-3.0.2/src/gtk/win_gtk.cpp.size-alloc-fix 2016-04-04 14:55:37.647728846 -0400
|
||||
+++ wxWidgets-3.0.2/src/gtk/win_gtk.cpp 2016-04-04 14:56:36.199637226 -0400
|
||||
@@ -192,8 +192,24 @@ static void pizza_remove(GtkContainer* c
|
||||
}
|
||||
|
||||
#ifdef __WXGTK3__
|
||||
+// Get preferred size of children, to avoid GTK+ warnings complaining
|
||||
+// that they were size-allocated without asking their preferred size
|
||||
+static void children_get_preferred_size(const GList* p)
|
||||
+{
|
||||
+ for (; p; p = p->next)
|
||||
+ {
|
||||
+ const wxPizzaChild* child = static_cast<wxPizzaChild*>(p->data);
|
||||
+ if (gtk_widget_get_visible(child->widget))
|
||||
+ {
|
||||
+ GtkRequisition req;
|
||||
+ gtk_widget_get_preferred_size(child->widget, &req, NULL);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void pizza_get_preferred_width(GtkWidget* widget, int* minimum, int* natural)
|
||||
{
|
||||
+ children_get_preferred_size(WX_PIZZA(widget)->m_children);
|
||||
*minimum = 0;
|
||||
gtk_widget_get_size_request(widget, natural, NULL);
|
||||
if (*natural < 0)
|
||||
@@ -202,6 +218,7 @@ static void pizza_get_preferred_width(Gt
|
||||
|
||||
static void pizza_get_preferred_height(GtkWidget* widget, int* minimum, int* natural)
|
||||
{
|
||||
+ children_get_preferred_size(WX_PIZZA(widget)->m_children);
|
||||
*minimum = 0;
|
||||
gtk_widget_get_size_request(widget, NULL, natural);
|
||||
if (*natural < 0)
|
@ -1,14 +0,0 @@
|
||||
diff -rupN wxWidgets-3.0.2-orig/src/gtk/spinbutt.cpp wxWidgets-3.0.2/src/gtk/spinbutt.cpp
|
||||
--- wxWidgets-3.0.2-orig/src/gtk/spinbutt.cpp 2014-10-06 17:33:44.000000000 -0400
|
||||
+++ wxWidgets-3.0.2/src/gtk/spinbutt.cpp 2015-08-22 10:44:00.743403904 -0400
|
||||
@@ -92,6 +92,10 @@ bool wxSpinButton::Create(wxWindow *pare
|
||||
g_object_ref(m_widget);
|
||||
|
||||
gtk_entry_set_width_chars(GTK_ENTRY(m_widget), 0);
|
||||
+#if GTK_CHECK_VERSION(3,12,0)
|
||||
+ if (gtk_check_version(3,12,0) == NULL)
|
||||
+ gtk_entry_set_max_width_chars(GTK_ENTRY(m_widget), 0);
|
||||
+#endif
|
||||
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget),
|
||||
(int)(m_windowStyle & wxSP_WRAP) );
|
||||
|
@ -1,39 +0,0 @@
|
||||
From 73e9e18ea09ffffcaac50237def0d9728a213c02 Mon Sep 17 00:00:00 2001
|
||||
From: Scott Talbert <swt@techie.net>
|
||||
Date: Sat, 20 Feb 2016 00:08:14 -0500
|
||||
Subject: [PATCH] Fix STC compilation with GCC6
|
||||
|
||||
Use std::abs() from <cmath> instead of abs() from <math.h> to avoid problems
|
||||
with ambiguous overloads.
|
||||
|
||||
Closes #17147.
|
||||
|
||||
Closes https://github.com/wxWidgets/wxWidgets/pull/222
|
||||
---
|
||||
src/stc/scintilla/src/Editor.cxx | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/stc/scintilla/src/Editor.cxx b/src/stc/scintilla/src/Editor.cxx
|
||||
index cd72953..2081df2 100644
|
||||
--- a/src/stc/scintilla/src/Editor.cxx
|
||||
+++ b/src/stc/scintilla/src/Editor.cxx
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
|
||||
+#include <cmath>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
@@ -5841,9 +5842,9 @@ void Editor::GoToLine(int lineNo) {
|
||||
}
|
||||
|
||||
static bool Close(Point pt1, Point pt2) {
|
||||
- if (abs(pt1.x - pt2.x) > 3)
|
||||
+ if (std::abs(pt1.x - pt2.x) > 3)
|
||||
return false;
|
||||
- if (abs(pt1.y - pt2.y) > 3)
|
||||
+ if (std::abs(pt1.y - pt2.y) > 3)
|
||||
return false;
|
||||
return true;
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
From 01f62c02957cc1443ea761ddffe0b4322d987a1d Mon Sep 17 00:00:00 2001
|
||||
From: Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
Date: Sun, 21 Jun 2015 15:56:06 +0200
|
||||
Subject: [PATCH] Avoid warnings about narrowing casts in the long long tests.
|
||||
|
||||
Recent g++ versions give -Wnarrowing warning when a value outside of the type
|
||||
range is used to initialize a variable of this type in { }. Avoid it in the
|
||||
long long tests using explicit casts as we already cast between long long and
|
||||
unsigned long long values here anyhow.
|
||||
---
|
||||
tests/strings/strings.cpp | 19 +++++++++++--------
|
||||
1 file changed, 11 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/tests/strings/strings.cpp b/tests/strings/strings.cpp
|
||||
index b016294..78a3a9d 100644
|
||||
--- a/tests/strings/strings.cpp
|
||||
+++ b/tests/strings/strings.cpp
|
||||
@@ -589,14 +589,16 @@ enum
|
||||
Number_Long = 16 // only for long tests
|
||||
};
|
||||
|
||||
+#ifdef wxLongLong_t
|
||||
+typedef wxLongLong_t TestValue_t;
|
||||
+#else
|
||||
+typedef long TestValue_t;
|
||||
+#endif
|
||||
+
|
||||
static const struct ToLongData
|
||||
{
|
||||
const wxChar *str;
|
||||
-#ifdef wxLongLong_t
|
||||
- wxLongLong_t value;
|
||||
-#else
|
||||
- long value;
|
||||
-#endif // wxLongLong_t
|
||||
+ TestValue_t value;
|
||||
int flags;
|
||||
int base;
|
||||
|
||||
@@ -618,7 +620,7 @@ static const struct ToLongData
|
||||
|
||||
{ wxT("-1"), -1, Number_Signed | Number_Long },
|
||||
// this is surprising but consistent with strtoul() behaviour
|
||||
- { wxT("-1"), ULONG_MAX, Number_Unsigned | Number_Long },
|
||||
+ { wxT("-1"), (TestValue_t)ULONG_MAX, Number_Unsigned | Number_Long },
|
||||
|
||||
// this must overflow, even with 64 bit long
|
||||
{ wxT("922337203685477580711"), 0, Number_Invalid },
|
||||
@@ -626,8 +628,9 @@ static const struct ToLongData
|
||||
#ifdef wxLongLong_t
|
||||
{ wxT("2147483648"), wxLL(2147483648), Number_LongLong },
|
||||
{ wxT("-2147483648"), wxLL(-2147483648), Number_LongLong | Number_Signed },
|
||||
- { wxT("9223372036854775808"), wxULL(9223372036854775808), Number_LongLong |
|
||||
- Number_Unsigned },
|
||||
+ { wxT("9223372036854775808"),
|
||||
+ TestValue_t(wxULL(9223372036854775808)),
|
||||
+ Number_LongLong | Number_Unsigned },
|
||||
#endif // wxLongLong_t
|
||||
|
||||
// Base tests.
|
@ -1,155 +0,0 @@
|
||||
diff -rupN wxWidgets-3.0.2-orig/src/generic/grid.cpp wxWidgets-3.0.2/src/generic/grid.cpp
|
||||
--- wxWidgets-3.0.2-orig/src/generic/grid.cpp 2014-10-06 17:33:44.000000000 -0400
|
||||
+++ wxWidgets-3.0.2/src/generic/grid.cpp 2015-06-22 11:50:16.359029017 -0400
|
||||
@@ -2114,7 +2114,8 @@ void wxGridWindow::OnFocus(wxFocusEvent&
|
||||
m_owner->GetGridCursorCol());
|
||||
const wxRect cursor =
|
||||
m_owner->BlockToDeviceRect(cursorCoords, cursorCoords);
|
||||
- Refresh(true, &cursor);
|
||||
+ if (cursor != wxGridNoCellRect)
|
||||
+ Refresh(true, &cursor);
|
||||
}
|
||||
|
||||
if ( !m_owner->GetEventHandler()->ProcessEvent( event ) )
|
||||
diff -rupN wxWidgets-3.0.2-orig/src/generic/listctrl.cpp wxWidgets-3.0.2/src/generic/listctrl.cpp
|
||||
--- wxWidgets-3.0.2-orig/src/generic/listctrl.cpp 2014-10-06 17:33:44.000000000 -0400
|
||||
+++ wxWidgets-3.0.2/src/generic/listctrl.cpp 2015-06-22 12:12:26.838603542 -0400
|
||||
@@ -1935,6 +1935,13 @@ void wxListMainWindow::RefreshLines( siz
|
||||
size_t visibleFrom, visibleTo;
|
||||
GetVisibleLinesRange(&visibleFrom, &visibleTo);
|
||||
|
||||
+ if ( lineFrom > visibleTo || lineTo < visibleFrom )
|
||||
+ {
|
||||
+ // None of these lines are currently visible at all, don't bother
|
||||
+ // doing anything.
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if ( lineFrom < visibleFrom )
|
||||
lineFrom = visibleFrom;
|
||||
if ( lineTo > visibleTo )
|
||||
diff -rupN wxWidgets-3.0.2-orig/src/gtk/aboutdlg.cpp wxWidgets-3.0.2/src/gtk/aboutdlg.cpp
|
||||
--- wxWidgets-3.0.2-orig/src/gtk/aboutdlg.cpp 2014-10-06 17:33:44.000000000 -0400
|
||||
+++ wxWidgets-3.0.2/src/gtk/aboutdlg.cpp 2015-06-22 12:09:00.951644896 -0400
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "wx/aboutdlg.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
- #include "wx/utils.h" // for wxLaunchDefaultBrowser()
|
||||
+ #include "wx/window.h"
|
||||
#endif //WX_PRECOMP
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
@@ -131,7 +131,7 @@ static void wxGtkAboutDialogOnLink(GtkAb
|
||||
}
|
||||
#endif
|
||||
|
||||
-void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* WXUNUSED(parent))
|
||||
+void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent)
|
||||
{
|
||||
// don't create another dialog if one is already present
|
||||
if ( !gs_aboutDialog )
|
||||
@@ -235,6 +235,11 @@ void wxAboutBox(const wxAboutDialogInfo&
|
||||
g_signal_connect(dlg, "response",
|
||||
G_CALLBACK(wxGtkAboutDialogOnClose), NULL);
|
||||
|
||||
+ GtkWindow* gtkParent = NULL;
|
||||
+ if (parent && parent->m_widget)
|
||||
+ gtkParent = (GtkWindow*)gtk_widget_get_ancestor(parent->m_widget, GTK_TYPE_WINDOW);
|
||||
+ gtk_window_set_transient_for(GTK_WINDOW(dlg), gtkParent);
|
||||
+
|
||||
gtk_window_present(GTK_WINDOW(dlg));
|
||||
}
|
||||
|
||||
diff -rupN wxWidgets-3.0.2-orig/src/gtk/filedlg.cpp wxWidgets-3.0.2/src/gtk/filedlg.cpp
|
||||
--- wxWidgets-3.0.2-orig/src/gtk/filedlg.cpp 2014-10-06 17:33:44.000000000 -0400
|
||||
+++ wxWidgets-3.0.2/src/gtk/filedlg.cpp 2015-06-22 12:16:47.386285719 -0400
|
||||
@@ -187,7 +187,8 @@ bool wxFileDialog::Create(wxWindow *pare
|
||||
const wxSize& sz,
|
||||
const wxString& name)
|
||||
{
|
||||
- parent = GetParentForModalDialog(parent, style);
|
||||
+ // wxFD_MULTIPLE has the same value as wxDIALOG_NO_PARENT
|
||||
+ parent = GetParentForModalDialog(parent, style & ~wxFD_MULTIPLE);
|
||||
|
||||
if (!wxFileDialogBase::Create(parent, message, defaultDir, defaultFileName,
|
||||
wildCard, style, pos, sz, name))
|
||||
diff -rupN wxWidgets-3.0.2-orig/src/gtk/fontdlg.cpp wxWidgets-3.0.2/src/gtk/fontdlg.cpp
|
||||
--- wxWidgets-3.0.2-orig/src/gtk/fontdlg.cpp 2014-10-06 17:33:44.000000000 -0400
|
||||
+++ wxWidgets-3.0.2/src/gtk/fontdlg.cpp 2015-06-22 11:51:23.827727490 -0400
|
||||
@@ -78,6 +78,7 @@ bool wxFontDialog::DoCreate(wxWindow *pa
|
||||
gtk_parent = GTK_WINDOW(parent->m_widget);
|
||||
|
||||
#if GTK_CHECK_VERSION(3,2,0)
|
||||
+ g_type_ensure(PANGO_TYPE_FONT_FACE);
|
||||
if (gtk_check_version(3,2,0) == NULL)
|
||||
m_widget = gtk_font_chooser_dialog_new(wxGTK_CONV(message), gtk_parent);
|
||||
else
|
||||
diff -rupN wxWidgets-3.0.2-orig/src/gtk/print.cpp wxWidgets-3.0.2/src/gtk/print.cpp
|
||||
--- wxWidgets-3.0.2-orig/src/gtk/print.cpp 2014-10-06 17:33:44.000000000 -0400
|
||||
+++ wxWidgets-3.0.2/src/gtk/print.cpp 2015-06-22 12:01:37.173889476 -0400
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "wx/fontutil.h"
|
||||
#include "wx/dynlib.h"
|
||||
#include "wx/paper.h"
|
||||
-#include "wx/scopeguard.h"
|
||||
#include "wx/modalhook.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
@@ -612,6 +611,11 @@ wxGtkPrintDialog::wxGtkPrintDialog( wxWi
|
||||
|
||||
m_parent = parent;
|
||||
SetShowDialog(true);
|
||||
+
|
||||
+ const wxPrintData& printData = m_printDialogData.GetPrintData();
|
||||
+ wxGtkPrintNativeData* native =
|
||||
+ static_cast<wxGtkPrintNativeData*>(printData.GetNativeData());
|
||||
+ native->SetPrintJob(gtk_print_operation_new());
|
||||
}
|
||||
|
||||
wxGtkPrintDialog::wxGtkPrintDialog( wxWindow *parent, wxPrintData *data )
|
||||
@@ -625,11 +629,22 @@ wxGtkPrintDialog::wxGtkPrintDialog( wxWi
|
||||
|
||||
m_parent = parent;
|
||||
SetShowDialog(true);
|
||||
+
|
||||
+ const wxPrintData& printData = m_printDialogData.GetPrintData();
|
||||
+ wxGtkPrintNativeData* native =
|
||||
+ static_cast<wxGtkPrintNativeData*>(printData.GetNativeData());
|
||||
+ native->SetPrintJob(gtk_print_operation_new());
|
||||
}
|
||||
|
||||
|
||||
wxGtkPrintDialog::~wxGtkPrintDialog()
|
||||
{
|
||||
+ const wxPrintData& printData = m_printDialogData.GetPrintData();
|
||||
+ wxGtkPrintNativeData* native =
|
||||
+ static_cast<wxGtkPrintNativeData*>(printData.GetNativeData());
|
||||
+ GtkPrintOperation* printOp = native->GetPrintJob();
|
||||
+ g_object_unref(printOp);
|
||||
+ native->SetPrintJob(NULL);
|
||||
}
|
||||
|
||||
// This is called even if we actually don't want the dialog to appear.
|
||||
@@ -921,10 +936,9 @@ bool wxGtkPrinter::Print(wxWindow *paren
|
||||
wxPrintData printdata = GetPrintDialogData().GetPrintData();
|
||||
wxGtkPrintNativeData *native = (wxGtkPrintNativeData*) printdata.GetNativeData();
|
||||
|
||||
- wxGtkObject<GtkPrintOperation> printOp(gtk_print_operation_new());
|
||||
- native->SetPrintJob(printOp);
|
||||
- wxON_BLOCK_EXIT_OBJ1(*native, wxGtkPrintNativeData::SetPrintJob,
|
||||
- static_cast<GtkPrintOperation*>(NULL));
|
||||
+ // wxGtkPrintDialog needs to be created first as it creates the PrintOp
|
||||
+ wxGtkPrintDialog dialog(parent, &m_printDialogData);
|
||||
+ GtkPrintOperation* printOp = native->GetPrintJob();
|
||||
|
||||
wxPrinterToGtkData dataToSend;
|
||||
dataToSend.printer = this;
|
||||
@@ -937,7 +951,6 @@ bool wxGtkPrinter::Print(wxWindow *paren
|
||||
|
||||
// This is used to setup the DC and
|
||||
// show the dialog if desired
|
||||
- wxGtkPrintDialog dialog( parent, &m_printDialogData );
|
||||
dialog.SetPrintDC(m_dc);
|
||||
dialog.SetShowDialog(prompt);
|
||||
|
@ -1,171 +0,0 @@
|
||||
From 41be4271e18a21acbcc30d1e61653190f8ef7a6d Mon Sep 17 00:00:00 2001
|
||||
From: Paul Cornett <paulcor@users.noreply.github.com>
|
||||
Date: Fri, 5 Feb 2016 10:26:06 -0800
|
||||
Subject: [PATCH] Adapt window decorations cache for client-side decorations
|
||||
|
||||
Fixes size calculations for TLWs created after the first one,
|
||||
with Wayland, Mir and Broadway. See #17336
|
||||
|
||||
(cherry picked from commit 91ea4872813b90ff91702a11abbe644cb1e5044b)
|
||||
---
|
||||
src/gtk/toplevel.cpp | 93 +++++++++++++++++++++++++++++++++++++++++++++++-----
|
||||
1 file changed, 84 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp
|
||||
index 7530b0f..c3d42e8 100644
|
||||
--- a/src/gtk/toplevel.cpp
|
||||
+++ b/src/gtk/toplevel.cpp
|
||||
@@ -40,6 +40,15 @@
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
#include <gdk/gdkwayland.h>
|
||||
+ #define HAS_CLIENT_DECOR
|
||||
+#endif
|
||||
+#ifdef GDK_WINDOWING_MIR
|
||||
+ #include <gdk/gdkmir.h>
|
||||
+ #define HAS_CLIENT_DECOR
|
||||
+#endif
|
||||
+#ifdef GDK_WINDOWING_BROADWAY
|
||||
+ #include <gdk/gdkbroadway.h>
|
||||
+ #define HAS_CLIENT_DECOR
|
||||
#endif
|
||||
|
||||
#include "wx/gtk/private.h"
|
||||
@@ -82,6 +91,26 @@ static enum {
|
||||
static bool gs_decorCacheValid;
|
||||
#endif
|
||||
|
||||
+#ifdef HAS_CLIENT_DECOR
|
||||
+static bool HasClientDecor(GtkWidget* widget)
|
||||
+{
|
||||
+ GdkDisplay* display = gtk_widget_get_display(widget);
|
||||
+#ifdef GDK_WINDOWING_WAYLAND
|
||||
+ if (GDK_IS_WAYLAND_DISPLAY(display))
|
||||
+ return true;
|
||||
+#endif
|
||||
+#ifdef GDK_WINDOWING_MIR
|
||||
+ if (GDK_IS_MIR_DISPLAY(display))
|
||||
+ return true;
|
||||
+#endif
|
||||
+#ifdef GDK_WINDOWING_BROADWAY
|
||||
+ if (GDK_IS_BROADWAY_DISPLAY(display))
|
||||
+ return true;
|
||||
+#endif
|
||||
+ return false;
|
||||
+}
|
||||
+#endif // HAS_CLIENT_DECOR
|
||||
+
|
||||
//-----------------------------------------------------------------------------
|
||||
// RequestUserAttention related functions
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -235,8 +264,24 @@ size_allocate(GtkWidget*, GtkAllocation* alloc, wxTopLevelWindowGTK* win)
|
||||
GtkAllocation a;
|
||||
gtk_widget_get_allocation(win->m_widget, &a);
|
||||
wxSize size(a.width, a.height);
|
||||
- size.x += win->m_decorSize.left + win->m_decorSize.right;
|
||||
- size.y += win->m_decorSize.top + win->m_decorSize.bottom;
|
||||
+#ifdef HAS_CLIENT_DECOR
|
||||
+ if (HasClientDecor(win->m_widget))
|
||||
+ {
|
||||
+ GtkAllocation a2;
|
||||
+ gtk_widget_get_allocation(win->m_mainWidget, &a2);
|
||||
+ wxTopLevelWindowGTK::DecorSize decorSize;
|
||||
+ decorSize.left = a2.x;
|
||||
+ decorSize.right = a.width - a2.width - a2.x;
|
||||
+ decorSize.top = a2.y;
|
||||
+ decorSize.bottom = a.height - a2.height - a2.y;
|
||||
+ win->GTKUpdateDecorSize(decorSize);
|
||||
+ }
|
||||
+ else
|
||||
+#endif
|
||||
+ {
|
||||
+ size.x += win->m_decorSize.left + win->m_decorSize.right;
|
||||
+ size.y += win->m_decorSize.top + win->m_decorSize.bottom;
|
||||
+ }
|
||||
win->m_width = size.x;
|
||||
win->m_height = size.y;
|
||||
|
||||
@@ -1062,8 +1107,13 @@ void wxTopLevelWindowGTK::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXU
|
||||
void wxTopLevelWindowGTK::GTKDoGetSize(int *width, int *height) const
|
||||
{
|
||||
wxSize size(m_width, m_height);
|
||||
- size.x -= m_decorSize.left + m_decorSize.right;
|
||||
- size.y -= m_decorSize.top + m_decorSize.bottom;
|
||||
+#ifdef HAS_CLIENT_DECOR
|
||||
+ if (!HasClientDecor(m_widget))
|
||||
+#endif
|
||||
+ {
|
||||
+ size.x -= m_decorSize.left + m_decorSize.right;
|
||||
+ size.y -= m_decorSize.top + m_decorSize.bottom;
|
||||
+ }
|
||||
if (size.x < 0) size.x = 0;
|
||||
if (size.y < 0) size.y = 0;
|
||||
#if wxUSE_LIBHILDON2
|
||||
@@ -1171,7 +1221,12 @@ void wxTopLevelWindowGTK::DoGetClientSize( int *width, int *height ) const
|
||||
base_type::DoGetClientSize(width, height);
|
||||
else
|
||||
{
|
||||
- GTKDoGetSize(width, height);
|
||||
+ int w = m_width - (m_decorSize.left + m_decorSize.right);
|
||||
+ int h = m_height - (m_decorSize.top + m_decorSize.bottom);
|
||||
+ if (w < 0) w = 0;
|
||||
+ if (h < 0) h = 0;
|
||||
+ if (width) *width = w;
|
||||
+ if (height) *height = h;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1193,8 +1248,20 @@ void wxTopLevelWindowGTK::DoSetSizeHints( int minW, int minH,
|
||||
hints.min_height = 1;
|
||||
hints.max_width = INT_MAX;
|
||||
hints.max_height = INT_MAX;
|
||||
- const int decorSize_x = m_decorSize.left + m_decorSize.right;
|
||||
- const int decorSize_y = m_decorSize.top + m_decorSize.bottom;
|
||||
+ int decorSize_x;
|
||||
+ int decorSize_y;
|
||||
+#ifdef HAS_CLIENT_DECOR
|
||||
+ if (HasClientDecor(m_widget))
|
||||
+ {
|
||||
+ decorSize_x = 0;
|
||||
+ decorSize_y = 0;
|
||||
+ }
|
||||
+ else
|
||||
+#endif
|
||||
+ {
|
||||
+ decorSize_x = m_decorSize.left + m_decorSize.right;
|
||||
+ decorSize_y = m_decorSize.top + m_decorSize.bottom;
|
||||
+ }
|
||||
if (minSize.x > decorSize_x)
|
||||
hints.min_width = minSize.x - decorSize_x;
|
||||
if (minSize.y > decorSize_y)
|
||||
@@ -1221,11 +1288,19 @@ void wxTopLevelWindowGTK::DoSetSizeHints( int minW, int minH,
|
||||
(GtkWindow*)m_widget, NULL, &hints, (GdkWindowHints)hints_mask);
|
||||
}
|
||||
|
||||
-#ifdef GDK_WINDOWING_X11
|
||||
void wxTopLevelWindowGTK::GTKUpdateDecorSize(const DecorSize& decorSize)
|
||||
{
|
||||
if (!IsMaximized() && !IsFullScreen())
|
||||
GetCachedDecorSize() = decorSize;
|
||||
+
|
||||
+#ifdef HAS_CLIENT_DECOR
|
||||
+ if (HasClientDecor(m_widget))
|
||||
+ {
|
||||
+ m_decorSize = decorSize;
|
||||
+ return;
|
||||
+ }
|
||||
+#endif
|
||||
+#ifdef GDK_WINDOWING_X11
|
||||
if (m_updateDecorSize && memcmp(&m_decorSize, &decorSize, sizeof(DecorSize)))
|
||||
{
|
||||
m_useCachedClientSize = false;
|
||||
@@ -1292,8 +1367,8 @@ void wxTopLevelWindowGTK::GTKUpdateDecorSize(const DecorSize& decorSize)
|
||||
showEvent.SetEventObject(this);
|
||||
HandleWindowEvent(showEvent);
|
||||
}
|
||||
-}
|
||||
#endif // GDK_WINDOWING_X11
|
||||
+}
|
||||
|
||||
wxTopLevelWindowGTK::DecorSize& wxTopLevelWindowGTK::GetCachedDecorSize()
|
||||
{
|
@ -1,59 +0,0 @@
|
||||
From 0388ce8e25535415d9bdd79ce14eb20e73859279 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Cornett <paulcor@users.noreply.github.com>
|
||||
Date: Sat, 6 Feb 2016 16:07:28 -0800
|
||||
Subject: [PATCH] Allow SetClientSize() to set correct size even when size of
|
||||
window decorations is not known
|
||||
|
||||
This should allow correct sizing of first TLW (when using SetClientSize())
|
||||
with backends using client-side decorations such as Wayland.
|
||||
|
||||
(cherry picked from commit bc4df78421a5b1e6fd9b218e89d03e59bd846d0a)
|
||||
---
|
||||
src/gtk/toplevel.cpp | 27 +++++++++++++++++++++++++++
|
||||
1 file changed, 27 insertions(+)
|
||||
|
||||
diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp
|
||||
index c3d42e8..a52dad0 100644
|
||||
--- a/src/gtk/toplevel.cpp
|
||||
+++ b/src/gtk/toplevel.cpp
|
||||
@@ -1194,6 +1194,14 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si
|
||||
}
|
||||
}
|
||||
|
||||
+extern "C" {
|
||||
+static gboolean reset_size_request(void* data)
|
||||
+{
|
||||
+ gtk_widget_set_size_request(GTK_WIDGET(data), -1, -1);
|
||||
+ return false;
|
||||
+}
|
||||
+}
|
||||
+
|
||||
void wxTopLevelWindowGTK::DoSetClientSize(int width, int height)
|
||||
{
|
||||
base_type::DoSetClientSize(width, height);
|
||||
@@ -1202,6 +1210,25 @@ void wxTopLevelWindowGTK::DoSetClientSize(int width, int height)
|
||||
// Has to be done after calling base because it calls SetSize,
|
||||
// which sets this true
|
||||
m_deferShowAllowed = false;
|
||||
+
|
||||
+ if (m_wxwindow)
|
||||
+ {
|
||||
+ // If window is not resizable or not yet shown, set size request on
|
||||
+ // client widget, to make it more likely window will get correct size
|
||||
+ // even if our decorations size cache is incorrect (as it will be before
|
||||
+ // showing first TLW).
|
||||
+ if (!gtk_window_get_resizable(GTK_WINDOW(m_widget)))
|
||||
+ {
|
||||
+ gtk_widget_set_size_request(m_widget, -1, -1);
|
||||
+ gtk_widget_set_size_request(m_wxwindow, m_clientWidth, m_clientHeight);
|
||||
+ }
|
||||
+ else if (!IsShown())
|
||||
+ {
|
||||
+ gtk_widget_set_size_request(m_wxwindow, m_clientWidth, m_clientHeight);
|
||||
+ // Cancel size request at next idle to allow resizing
|
||||
+ g_idle_add_full(G_PRIORITY_LOW, reset_size_request, m_wxwindow, NULL);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
void wxTopLevelWindowGTK::DoGetClientSize( int *width, int *height ) const
|
@ -1,108 +0,0 @@
|
||||
diff -rupN wxWidgets-3.0.2/src/gtk/toplevel.cpp wxWidgets-3.0.2-wayland/src/gtk/toplevel.cpp
|
||||
--- wxWidgets-3.0.2/src/gtk/toplevel.cpp 2014-10-06 17:33:44.000000000 -0400
|
||||
+++ wxWidgets-3.0.2-wayland/src/gtk/toplevel.cpp 2015-12-31 14:48:25.873812357 -0500
|
||||
@@ -456,8 +456,12 @@ gtk_frame_window_state_callback( GtkWidg
|
||||
bool wxGetFrameExtents(GdkWindow* window, int* left, int* right, int* top, int* bottom)
|
||||
{
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
- static GdkAtom property = gdk_atom_intern("_NET_FRAME_EXTENTS", false);
|
||||
GdkDisplay* display = gdk_window_get_display(window);
|
||||
+
|
||||
+ if (!GDK_IS_X11_DISPLAY(display))
|
||||
+ return false;
|
||||
+
|
||||
+ static GdkAtom property = gdk_atom_intern("_NET_FRAME_EXTENTS", false);
|
||||
Atom xproperty = gdk_x11_atom_to_xatom_for_display(display, property);
|
||||
Atom type;
|
||||
int format;
|
||||
@@ -852,10 +856,19 @@ bool wxTopLevelWindowGTK::ShowFullScreen
|
||||
|
||||
m_fsIsShowing = show;
|
||||
|
||||
+ wxX11FullScreenMethod method = wxX11_FS_WMSPEC;
|
||||
+ Display* xdpy = NULL;
|
||||
+ Window xroot = None;
|
||||
+
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
- Display* xdpy = GDK_DISPLAY_XDISPLAY(gtk_widget_get_display(m_widget));
|
||||
- Window xroot = GDK_WINDOW_XID(gtk_widget_get_root_window(m_widget));
|
||||
- wxX11FullScreenMethod method = wxGetFullScreenMethodX11(xdpy, (WXWindow)xroot);
|
||||
+ GdkDisplay *display = gtk_widget_get_display(m_widget);
|
||||
+
|
||||
+ if (GDK_IS_X11_DISPLAY(display))
|
||||
+ {
|
||||
+ xdpy = GDK_DISPLAY_XDISPLAY(gtk_widget_get_display(m_widget));
|
||||
+ xroot = GDK_WINDOW_XID(gtk_widget_get_root_window(m_widget));
|
||||
+ method = wxGetFullScreenMethodX11(xdpy, (WXWindow)xroot);
|
||||
+ }
|
||||
|
||||
// NB: gtk_window_fullscreen() uses freedesktop.org's WMspec extensions
|
||||
// to switch to fullscreen, which is not always available. We must
|
||||
@@ -870,7 +883,7 @@ bool wxTopLevelWindowGTK::ShowFullScreen
|
||||
gtk_window_unfullscreen( GTK_WINDOW( m_widget ) );
|
||||
}
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
- else
|
||||
+ else if (xdpy != NULL)
|
||||
{
|
||||
GdkWindow* window = gtk_widget_get_window(m_widget);
|
||||
Window xid = GDK_WINDOW_XID(window);
|
||||
@@ -958,6 +971,7 @@ bool wxTopLevelWindowGTK::Show( bool sho
|
||||
deferShow = m_deferShowAllowed &&
|
||||
gs_requestFrameExtentsStatus != RFE_STATUS_BROKEN &&
|
||||
!gtk_widget_get_realized(m_widget) &&
|
||||
+ GDK_IS_X11_DISPLAY(gtk_widget_get_display(m_widget)) &&
|
||||
g_signal_handler_find(m_widget,
|
||||
GSignalMatchType(G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DATA),
|
||||
g_signal_lookup("property_notify_event", GTK_TYPE_WIDGET),
|
||||
diff -rupN wxWidgets-3.0.2/src/gtk/window.cpp wxWidgets-3.0.2-wayland/src/gtk/window.cpp
|
||||
--- wxWidgets-3.0.2/src/gtk/window.cpp 2014-10-06 17:33:44.000000000 -0400
|
||||
+++ wxWidgets-3.0.2-wayland/src/gtk/window.cpp 2015-12-31 14:48:31.522812743 -0500
|
||||
@@ -780,28 +780,31 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& e
|
||||
}
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
- // we want to always get the same key code when the same key is
|
||||
- // pressed regardless of the state of the modifiers, i.e. on a
|
||||
- // standard US keyboard pressing '5' or '%' ('5' key with
|
||||
- // Shift) should result in the same key code in OnKeyDown():
|
||||
- // '5' (although OnChar() will get either '5' or '%').
|
||||
- //
|
||||
- // to do it we first translate keysym to keycode (== scan code)
|
||||
- // and then back but always using the lower register
|
||||
- Display *dpy = (Display *)wxGetDisplay();
|
||||
- KeyCode keycode = XKeysymToKeycode(dpy, keysym);
|
||||
+ if (GDK_IS_X11_DISPLAY(gdk_window_get_display(gdk_event->window)))
|
||||
+ {
|
||||
+ // we want to always get the same key code when the same key is
|
||||
+ // pressed regardless of the state of the modifiers, i.e. on a
|
||||
+ // standard US keyboard pressing '5' or '%' ('5' key with
|
||||
+ // Shift) should result in the same key code in OnKeyDown():
|
||||
+ // '5' (although OnChar() will get either '5' or '%').
|
||||
+ //
|
||||
+ // to do it we first translate keysym to keycode (== scan code)
|
||||
+ // and then back but always using the lower register
|
||||
+ Display *dpy = (Display *)wxGetDisplay();
|
||||
+ KeyCode keycode = XKeysymToKeycode(dpy, keysym);
|
||||
|
||||
- wxLogTrace(TRACE_KEYS, wxT("\t-> keycode %d"), keycode);
|
||||
+ wxLogTrace(TRACE_KEYS, wxT("\t-> keycode %d"), keycode);
|
||||
|
||||
#ifdef HAVE_X11_XKBLIB_H
|
||||
- KeySym keysymNormalized = XkbKeycodeToKeysym(dpy, keycode, 0, 0);
|
||||
+ KeySym keysymNormalized = XkbKeycodeToKeysym(dpy, keycode, 0, 0);
|
||||
#else
|
||||
- KeySym keysymNormalized = XKeycodeToKeysym(dpy, keycode, 0);
|
||||
+ KeySym keysymNormalized = XKeycodeToKeysym(dpy, keycode, 0);
|
||||
#endif
|
||||
|
||||
- // use the normalized, i.e. lower register, keysym if we've
|
||||
- // got one
|
||||
- key_code = keysymNormalized ? keysymNormalized : keysym;
|
||||
+ // use the normalized, i.e. lower register, keysym if we've
|
||||
+ // got one
|
||||
+ key_code = keysymNormalized ? keysymNormalized : keysym;
|
||||
+ }
|
||||
#else
|
||||
key_code = keysym;
|
||||
#endif
|
@ -1,121 +0,0 @@
|
||||
From 98065821bbf0178981b50515094f565b703fcaa8 Mon Sep 17 00:00:00 2001
|
||||
From: Scott Talbert <swt@techie.net>
|
||||
Date: Tue, 13 Sep 2016 13:24:12 +0200
|
||||
Subject: [PATCH] Fix wxGetKeyState() on non-X11 wxGTK backends (e.g., Wayland)
|
||||
|
||||
wxGetKeyState() does not currently work on non-X11 GTK backends, and in some
|
||||
cases it has been reported to crash. It seems that the most likely use case
|
||||
for wxGetKeyState() is to query the modifier keys, so on non-X11 backends, use
|
||||
GTK+ calls to retrieve the modifier key state.
|
||||
|
||||
Non-modifier keys are not currently implemented, update the documentation to
|
||||
mention this.
|
||||
|
||||
Closes https://github.com/wxWidgets/wxWidgets/pull/322
|
||||
|
||||
(this is a combined backport of 1033fb048dec849906f76ece25f154e6a61fde4e,
|
||||
9f9c09e24a7f9d86ea51997bd4c55c1ddb7c3159 and
|
||||
a18fe083cc91bee442863c8ab7f97d6549f2b75c from master)
|
||||
---
|
||||
interface/wx/utils.h | 3 +++
|
||||
src/unix/utilsx11.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++++++++--
|
||||
2 files changed, 63 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/interface/wx/utils.h b/interface/wx/utils.h
|
||||
index 0bac1c0..f127a74 100644
|
||||
--- a/interface/wx/utils.h
|
||||
+++ b/interface/wx/utils.h
|
||||
@@ -372,6 +372,9 @@ wxString wxGetDisplayName();
|
||||
Even though there are virtual key codes defined for mouse buttons, they
|
||||
cannot be used with this function currently.
|
||||
|
||||
+ In wxGTK, this function can be only used with modifier keys (@c WXK_ALT, @c
|
||||
+ WXK_CONTROL and @c WXK_SHIFT) when not using X11 backend currently.
|
||||
+
|
||||
@header{wx/utils.h}
|
||||
*/
|
||||
bool wxGetKeyState(wxKeyCode key);
|
||||
diff --git a/src/unix/utilsx11.cpp b/src/unix/utilsx11.cpp
|
||||
index 6b35551..efc0837 100644
|
||||
--- a/src/unix/utilsx11.cpp
|
||||
+++ b/src/unix/utilsx11.cpp
|
||||
@@ -809,7 +809,7 @@ WXKeySym wxCharCodeWXToX(int id)
|
||||
// check current state of a key
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
-bool wxGetKeyState(wxKeyCode key)
|
||||
+static bool wxGetKeyStateX11(wxKeyCode key)
|
||||
{
|
||||
wxASSERT_MSG(key != WXK_LBUTTON && key != WXK_RBUTTON && key !=
|
||||
WXK_MBUTTON, wxT("can't use wxGetKeyState() for mouse buttons"));
|
||||
@@ -851,11 +851,69 @@ bool wxGetKeyState(wxKeyCode key)
|
||||
// with the least-significant bit in the byte representing key 8N.
|
||||
char key_vector[32];
|
||||
XQueryKeymap(pDisplay, key_vector);
|
||||
- return key_vector[keyCode >> 3] & (1 << (keyCode & 7));
|
||||
+ return (key_vector[keyCode >> 3] & (1 << (keyCode & 7))) != 0;
|
||||
}
|
||||
|
||||
#endif // !defined(__WXGTK__) || defined(GDK_WINDOWING_X11)
|
||||
|
||||
+// We need to use GDK functions when using wxGTK with a non-X11 backend, the
|
||||
+// X11 code above can't work in this case.
|
||||
+#ifdef __WXGTK__
|
||||
+
|
||||
+// gdk_keymap_get_modifier_state() is only available since 3.4
|
||||
+#if GTK_CHECK_VERSION(3,4,0)
|
||||
+
|
||||
+#define wxHAS_GETKEYSTATE_GTK
|
||||
+
|
||||
+extern GtkWidget *wxGetRootWindow();
|
||||
+
|
||||
+static bool wxGetKeyStateGTK(wxKeyCode key)
|
||||
+{
|
||||
+ if (gtk_check_version(3,4,0) != NULL)
|
||||
+ return false;
|
||||
+
|
||||
+ GdkDisplay* display = gtk_widget_get_display(wxGetRootWindow());
|
||||
+ GdkKeymap* keymap = gdk_keymap_get_for_display(display);
|
||||
+ guint state = gdk_keymap_get_modifier_state(keymap);
|
||||
+ guint mask = 0;
|
||||
+ switch (key)
|
||||
+ {
|
||||
+ case WXK_ALT:
|
||||
+ mask = GDK_MOD1_MASK;
|
||||
+ break;
|
||||
+
|
||||
+ case WXK_CONTROL:
|
||||
+ mask = GDK_CONTROL_MASK;
|
||||
+ break;
|
||||
+
|
||||
+ case WXK_SHIFT:
|
||||
+ mask = GDK_SHIFT_MASK;
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ wxFAIL_MSG(wxS("Unsupported key, only modifiers can be used"));
|
||||
+ return false;
|
||||
+ }
|
||||
+ return (state & mask) != 0;
|
||||
+}
|
||||
+
|
||||
+#endif // GTK+ 3.4
|
||||
+#endif // __WXGTK__
|
||||
+
|
||||
+bool wxGetKeyState(wxKeyCode key)
|
||||
+{
|
||||
+#ifdef wxHAS_GETKEYSTATE_GTK
|
||||
+ GdkDisplay* display = gtk_widget_get_display(wxGetRootWindow());
|
||||
+ const char* name = g_type_name(G_TYPE_FROM_INSTANCE(display));
|
||||
+ if (strcmp(name, "GdkX11Display") != 0)
|
||||
+ {
|
||||
+ return wxGetKeyStateGTK(key);
|
||||
+ }
|
||||
+#endif // GTK+ 3.4+
|
||||
+
|
||||
+ return wxGetKeyStateX11(key);
|
||||
+}
|
||||
+
|
||||
// ----------------------------------------------------------------------------
|
||||
// Launch document with default app
|
||||
// ----------------------------------------------------------------------------
|
@ -1,21 +0,0 @@
|
||||
From dcc23ceba8e1dba828e8b3e4633ac77acaad7562 Mon Sep 17 00:00:00 2001
|
||||
From: Robin Dunn <robin@alldunn.com>
|
||||
Date: Thu, 5 Mar 2015 15:14:23 -0800
|
||||
Subject: [PATCH] Change ~wxPGChoicesData from private to protected
|
||||
|
||||
---
|
||||
include/wx/propgrid/property.h | 1 +
|
||||
interface/wx/propgrid/property.h | 3 +++
|
||||
2 files changed, 4 insertions(+)
|
||||
|
||||
diff --git a/include/wx/propgrid/property.h b/include/wx/propgrid/property.h
|
||||
index bc61848..ab1439d 100644
|
||||
--- a/include/wx/propgrid/property.h
|
||||
+++ b/include/wx/propgrid/property.h
|
||||
@@ -803,6 +803,7 @@ class WXDLLIMPEXP_PROPGRID wxPGChoicesData : public wxObjectRefData
|
||||
private:
|
||||
wxVector<wxPGChoiceEntry> m_items;
|
||||
|
||||
+protected:
|
||||
virtual ~wxPGChoicesData();
|
||||
};
|
Loading…
Reference in new issue