[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/inc vcl/unx

2016-12-13 Thread Caolán McNamara
 vcl/inc/unx/gtk/gtkframe.hxx  |1 +
 vcl/unx/gtk/gtksalmenu.cxx|1 +
 vcl/unx/gtk3/gtk3gtkframe.cxx |7 ++-
 3 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 24aecb12dd8a1050b0590cadf3d9ed41a2c23fc8
Author: Caolán McNamara 
Date:   Tue Dec 6 21:03:07 2016 +

Resolves: rhbz#1401778 gtk3+wayland switching windows from the menu woes

ignore 0 timestamps cause they're useless and get the current event time
stamp during MenuBarReturnFocus to determine the timestamp of the menu
command dispatch

(cherry picked from commit adfcd16220444ef3ea318515c5a331210250e45f)

Change-Id: Ia4b00aafc9ef47b41dcca2c160e943200db5c524
(cherry picked from commit 1b2bb1c952a3e8dc5c625c7a9f0042f06ba1c9a0)
Reviewed-on: https://gerrit.libreoffice.org/31706
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 1b48aa3..b402bb2 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -544,6 +544,7 @@ public:
 guint* pGdkKeyCode, GdkModifierType *pGdkModifiers);
 
 static guint32  GetLastInputEventTime();
+static void UpdateLastInputEventTime(guint32 
nUserInputTime);
 };
 
 #define OOO_TYPE_FIXED ooo_fixed_get_type()
diff --git a/vcl/unx/gtk/gtksalmenu.cxx b/vcl/unx/gtk/gtksalmenu.cxx
index c891cf3..75cab1c 100644
--- a/vcl/unx/gtk/gtksalmenu.cxx
+++ b/vcl/unx/gtk/gtksalmenu.cxx
@@ -679,6 +679,7 @@ bool GtkSalMenu::TakeFocus()
 
 static void MenuBarReturnFocus(GtkMenuShell*, gpointer menu)
 {
+GtkSalFrame::UpdateLastInputEventTime(gtk_get_current_event_time());
 GtkSalMenu* pMenu = static_cast(menu);
 pMenu->ReturnFocus();
 }
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index d016d32..00438ea 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -2028,8 +2028,13 @@ guint32 GtkSalFrame::GetLastInputEventTime()
 return nLastUserInputTime;
 }
 
-static void UpdateLastInputEventTime(guint32 nUserInputTime)
+void GtkSalFrame::UpdateLastInputEventTime(guint32 nUserInputTime)
 {
+//gtk3 can generate a synthetic crossing event with a useless 0
+//(GDK_CURRENT_TIME) timestamp on showing a menu from the main
+//menubar, which is unhelpful, so ignore the 0 timestamps
+if (nUserInputTime == GDK_CURRENT_TIME)
+return;
 nLastUserInputTime = nUserInputTime;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/inc vcl/unx

2016-12-11 Thread Caolán McNamara
 vcl/inc/unx/gtk/gtkdata.hxx   |2 --
 vcl/unx/gtk/gtkdata.cxx   |1 -
 vcl/unx/gtk3/gtk3gtkdata.cxx  |   14 --
 vcl/unx/gtk3/gtk3gtkframe.cxx |2 +-
 vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx |8 +---
 5 files changed, 2 insertions(+), 25 deletions(-)

New commits:
commit 104a31ea86ed3270ee5392bb09a66b4e063acb69
Author: Caolán McNamara 
Date:   Thu Nov 24 10:19:43 2016 +

Resolves: rhbz#1362453 use the cairo scaling approach on both wayland and X

so have the same hidpi solution on both setups

Change-Id: I669eba55830a28c1850f4679dfa824798bd3a383
Reviewed-on: https://gerrit.libreoffice.org/31540
Tested-by: Jenkins 
Reviewed-by: Khaled Hosny 
(cherry picked from commit 3a9609653697ac851ee1c55a41aa143d3bca335e)
Reviewed-on: https://gerrit.libreoffice.org/31836
Tested-by: Khaled Hosny 
(cherry picked from commit abf54716da33b8252c32b545bd02b33eef3b9a07)
Reviewed-on: https://gerrit.libreoffice.org/31876

diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx
index 98c96dd..037d213 100644
--- a/vcl/inc/unx/gtk/gtkdata.hxx
+++ b/vcl/inc/unx/gtk/gtkdata.hxx
@@ -138,7 +138,6 @@ class GtkSalDisplay : public SalDisplay
 o3tl::enumarray m_aCursors;
 boolm_bStartupCompleted;
 boolm_bX11Display;
-boolm_bOwnHiDpiScale;
 
 GdkCursor* getFromXBM( const unsigned char *pBitmap, const unsigned char 
*pMask,
int nWidth, int nHeight, int nXHot, int nYHot );
@@ -148,7 +147,6 @@ public:
 
 GdkDisplay* GetGdkDisplay() const { return m_pGdkDisplay; }
 boolIsX11Display() const { return m_bX11Display; }
-boolIsOwnHiDpiScale() const { return m_bOwnHiDpiScale; }
 
 GtkSalSystem* getSystem() const { return m_pSys; }
 
diff --git a/vcl/unx/gtk/gtkdata.cxx b/vcl/unx/gtk/gtkdata.cxx
index 3a22a6d..8db0513 100644
--- a/vcl/unx/gtk/gtkdata.cxx
+++ b/vcl/unx/gtk/gtkdata.cxx
@@ -80,7 +80,6 @@ GtkSalDisplay::GtkSalDisplay( GdkDisplay* pDisplay ) :
 GetGenericData()->ErrorTrapPush(); // and leak the trap
 
 m_bX11Display = true;
-m_bOwnHiDpiScale = true;
 
 gtk_widget_set_default_direction(AllSettings::GetLayoutRTL() ? 
GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
 }
diff --git a/vcl/unx/gtk3/gtk3gtkdata.cxx b/vcl/unx/gtk3/gtk3gtkdata.cxx
index 4207995..d5cad5e 100644
--- a/vcl/unx/gtk3/gtk3gtkdata.cxx
+++ b/vcl/unx/gtk3/gtk3gtkdata.cxx
@@ -81,20 +81,6 @@ GtkSalDisplay::GtkSalDisplay( GdkDisplay* pDisplay ) :
 GetGenericData()->ErrorTrapPush(); // and leak the trap
 
 m_bX11Display = GDK_IS_X11_DISPLAY( m_pGdkDisplay );
-m_bOwnHiDpiScale = false;
-
-#if GTK_CHECK_VERSION(3,10,0)
-#ifdef GDK_WINDOWING_X11
-if (m_bX11Display)
-{
-if (!getenv("GDK_SCALE"))
-{
-gdk_x11_display_set_window_scale(m_pGdkDisplay, 1);
-m_bOwnHiDpiScale = true;
-}
-}
-#endif
-#endif
 
 gtk_widget_set_default_direction(AllSettings::GetLayoutRTL() ? 
GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
 }
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 17b9e27..d016d32 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1576,7 +1576,7 @@ void GtkSalFrame::AllocateFrame()
 
 #if GTK_CHECK_VERSION(3,10,0)
 #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0)
-int scale = getDisplay()->IsOwnHiDpiScale() ? 1 : 
gtk_widget_get_scale_factor(m_pWindow);
+int scale = gtk_widget_get_scale_factor(m_pWindow);
 #else
 int scale = 1;
 #endif
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx 
b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 60fc82d..cdf4f08 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -3102,14 +3102,8 @@ void GtkSalGraphics::GetResolution(sal_Int32& rDPIX, 
sal_Int32& rDPIY)
 double fResolution = -1.0;
 g_object_get(pScreen, "resolution", , nullptr);
 
-int nScaleFactor = 1;
-
-#if GTK_CHECK_VERSION(3, 10, 0)
-nScaleFactor = GtkSalFrame::getDisplay()->IsOwnHiDpiScale() ? 
gtk_widget_get_scale_factor(mpWindow) : 1;
-#endif
-
 if (fResolution > 0.0)
-rDPIX = rDPIY = sal_Int32(fResolution * nScaleFactor);
+rDPIX = rDPIY = sal_Int32(fResolution);
 else
 rDPIX = rDPIY = 96;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/inc vcl/unx

2016-11-24 Thread Caolán McNamara
 vcl/inc/unx/cairotextrender.hxx|6 -
 vcl/inc/unx/fc_fontoptions.hxx |3 +-
 vcl/inc/unx/freetype_glyphcache.hxx|1 
 vcl/inc/unx/glyphcache.hxx |3 +-
 vcl/unx/generic/fontmanager/fontconfig.cxx |   29 -
 vcl/unx/generic/gdi/cairotextrender.cxx|9 ++-
 vcl/unx/generic/glyphs/freetype_glyphcache.cxx |   17 ++
 7 files changed, 39 insertions(+), 29 deletions(-)

New commits:
commit 65bc0588eb9e9212238768b3418711fbe881510f
Author: Caolán McNamara 
Date:   Wed Nov 23 14:54:50 2016 +

with wayland scaling cairo is meddling with our font

so I see mixed large scaled and small unscaled letters in the writer 
header/footer
widget among other places

so don't give it our FreeType font face (FC_FT_FACE), keep that for 
ourselves,
but instead set the filename and face index and let it make a new one 
itself.

Reviewed-on: https://gerrit.libreoffice.org/31127
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit 8c3e1465223bd8c824c4cecfd0e6fc387583e592)

Change-Id: I2e5eceb7bf590ccfeb06123d0404120feacfff97
Reviewed-on: https://gerrit.libreoffice.org/31155
Tested-by: Jenkins 
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/inc/unx/cairotextrender.hxx b/vcl/inc/unx/cairotextrender.hxx
index 612daae..6427951 100644
--- a/vcl/inc/unx/cairotextrender.hxx
+++ b/vcl/inc/unx/cairotextrender.hxx
@@ -28,8 +28,10 @@
 
 typedef struct FT_FaceRec_* FT_Face;
 
+class FontConfigFontOptions;
 class ServerFont;
 class GlyphCache;
+class FontConfigFontOptions;
 typedef struct _cairo cairo_t;
 
 class VCL_DLLPUBLIC CairoFontsCache
@@ -38,7 +40,7 @@ public:
 struct CacheId
 {
 FT_Face maFace;
-const void *mpOptions;
+const FontConfigFontOptions *mpOptions;
 bool mbEmbolden;
 bool mbVerticalMetrics;
 bool operator ==(const CacheId& rOther) const
@@ -124,6 +126,8 @@ public:
 #endif
 };
 
+FontConfigFontOptions* GetFCFontOptions( const FontAttributes& 
rFontAttributes, int nSize);
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/fc_fontoptions.hxx b/vcl/inc/unx/fc_fontoptions.hxx
index d085e26..5a2af5d 100644
--- a/vcl/inc/unx/fc_fontoptions.hxx
+++ b/vcl/inc/unx/fc_fontoptions.hxx
@@ -51,7 +51,8 @@ public:
 boolDontUseEmbeddedBitmaps() const { return 
meEmbeddedBitmap == EMBEDDEDBITMAP_FALSE; }
 boolDontUseAntiAlias() const { return meAntiAlias == 
ANTIALIAS_FALSE; }
 boolDontUseHinting() const { return (meHinting == 
HINTING_FALSE) || (GetHintStyle() == FontHintStyle::NONE); }
-void*   GetPattern(void * /*pFace*/, bool /*bEmbolden*/) const;
+voidSyncPattern(const OString& rFileName, int nFontFace, 
bool bEmbolden);
+FcPattern*  GetPattern() const;
 private:
 FcPattern* mpPattern;
 };
diff --git a/vcl/inc/unx/freetype_glyphcache.hxx 
b/vcl/inc/unx/freetype_glyphcache.hxx
index 3b8d315..7acdbd6 100644
--- a/vcl/inc/unx/freetype_glyphcache.hxx
+++ b/vcl/inc/unx/freetype_glyphcache.hxx
@@ -72,6 +72,7 @@ public:
 void  ReleaseFaceFT();
 
 const OString&GetFontFileName() const   { return 
mpFontFile->GetFileName(); }
+int   GetFontFaceIndex() const  { return mnFaceNum; }
 sal_IntPtrGetFontId() const { return mnFontId; }
 bool  IsSymbolFont() const  { return 
maDevFontAttributes.IsSymbolFont(); }
 const FontAttributes& GetFontAttributes() const { return 
maDevFontAttributes; }
diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx
index 04723cb..f605e16 100644
--- a/vcl/inc/unx/glyphcache.hxx
+++ b/vcl/inc/unx/glyphcache.hxx
@@ -151,6 +151,7 @@ public:
 virtual ~ServerFont();
 
 const OString&  GetFontFileName() const;
+int GetFontFaceIndex() const;
 boolTestFont() const { return mbFaceOk;}
 FT_Face GetFtFace() const;
 int GetLoadFlags() const { return (mnLoadFlags & 
~FT_LOAD_IGNORE_TRANSFORM); }
@@ -229,7 +230,7 @@ private:
 FT_FaceRec_*maFaceFT;
 FT_SizeRec_*maSizeFT;
 
-std::shared_ptr mxFontOptions;
+mutable std::shared_ptr mxFontOptions;
 
 boolmbFaceOk;
 boolmbArtItalic;
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx 
b/vcl/unx/generic/fontmanager/fontconfig.cxx
index 957afb14..79971d5 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -1143,21 +1143,20 @@ 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/inc vcl/unx

2016-11-24 Thread Caolán McNamara
 vcl/inc/unx/gtk/gtkgdi.hxx|   88 +
 vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 1692 --
 2 files changed, 1215 insertions(+), 565 deletions(-)

New commits:
commit 83dc2227f35795aee4e2ccaccbb7d67d4c50ba3f
Author: Caolán McNamara 
Date:   Wed Oct 12 21:17:43 2016 +0100

Resolves: tdf#92776 backport gtk3 >= 3.20 themeing improvements

Related: tdf#92776 set parent style of notebook to toplevel window style

Change-Id: Iec16b2617c82c363a540f967f66c514b5b2b104b
(cherry picked from commit 570669631359021a8ad420753c87bcf4419d06cd)

Related: tdf#101699 gtk3: get correct combobox and listbox arrows

Change-Id: Ib2322bfda09b05925c74d93a530b9ed9fac73032
(cherry picked from commit 6e8dbdbe1a9d15d7e7d000e4132fd5df3fecd660)

Related: tdf#101699 gtk3: get correct arrow width

Change-Id: If02c598306ec6f19cf83958c4a176cafa67076dc
(cherry picked from commit 4cb720836ab03701ce508e302790c115c7808619)

silence warnings

Change-Id: I80abf5092c7d4e7b8cf75e4b79ffdb9a5e0c7580
(cherry picked from commit 7ae079274d15ab309c9811c0b3966bed727a6afe)

loplugin:nullptr

Change-Id: Id9f702b2772a23c52a9b829093d10c83a5ab3acd
(cherry picked from commit 1f8f140601bd654f97d0c1e6e05b3bef949ddfaf)

bundle duplicate code together

Change-Id: Id67e5026e21138c0583df8099436da01e4e2dab3
(cherry picked from commit e3fca8b4a0f5e517f994b35f1d4ff152fb17c3a2)

split these ifdefs into larger blocks

Change-Id: I501d06096aa51066af8806277b7d392e39747494
(cherry picked from commit d5b8b98393f529d1181b0305313a95ab90ef0bf2)

gtk3: select old/new gtk theme behaviour etc at runtime

Reviewed-on: https://gerrit.libreoffice.org/29969
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit 70f7697c4243739c28feaa33b091f6c64a8356cb)

Change-Id: Ie09419049e3d839315f4fc8a937f0dde74688d98

need 3.19.2 or above for these

(cherry picked from commit dd04278bfc3c89336283fcab1222147dcd796a77)

Change-Id: If385b45b12c72a0d7460a9a4c9d0b0e3bfc1195e

use released 3.20.0 instead of 3.19.2

(cherry picked from commit 4fce8bd59eae6d2ed6e5a3f9a3d4898fcd3431a9)

Change-Id: Iac311e0c326cf79a2dbacb889d39ab49ccaa9325

Resolves: tdf#101699 get combobox junction right

gtk3-demo has examples of foreign drawing, follow
the patterns there to figure out what to do, add
stuff to gtk3-demo to demo what we need to do if
any particular case here is lacking

Change-Id: Ia1a22280161c97a3eab2d94fc4744fe971d31727
(cherry picked from commit e2af8f92a7308bc28c257b7905ec3a8a724554b1)

gtk3: rework theme code to separate old and new theming schemes

Change-Id: I7c1341a920c4607937ffab06c182a0ba0e0b26fd
(cherry picked from commit ac53789077eef17e2d895826abfe22888716600a)

older gtk3 versions still out there to build against

Change-Id: I64cb12185fc3943a211928e35e756b82942095b0
(cherry picked from commit a906f24a7830a12c4f1e2f8fa0c3df7961a64d6c)

GTK_STYLE_CLASS_POPUP not defined in older gtks

Change-Id: I6192d13419aab42993e4b6dc011db30a4c3c1787
(cherry picked from commit 7403c95540ba96a304eaebcb4845e910746133bb)

Resolves: tdf#92776 ensure correct notebook tab font color

despite various theme layout differences

Change-Id: I209258583571b57b2b7869937fa4821855125eac
(cherry picked from commit 69c9acd4b8dcd7ec8a5c3c380ad5cd8b797661ea)

gtk3: split out gtk->vcl font mapping code

(cherry picked from commit eb935ee8f511265038a949f74958ae716ac0e8ca)

Change-Id: Ic379307ba9e663e0ffc27c945852f6d68197f995

gtk3: use theme tab font

Change-Id: I3ea5a9e65e62133c910945e603bdc1155c9a07c3
(cherry picked from commit d786606b33cfc146a3a1f3adf814196993d3b310)

gtk3: split tabitem rendering to a standalone thing

Change-Id: I88cd8926b733717c9ea0ecf64a9882eaa777dcfe
(cherry picked from commit dcfddd3f079a45fc59fe50475020091c6c4694e2)

GTK_STYLE_CLASS_LABEL no defined in all versions

Change-Id: I648067e30d5a2e725111b2bc920367ac2d5e0f80
(cherry picked from commit 352ddafd05c5de4335746d52c79e8cf9689cba86)

Resolves: tdf#89760 get correct menubar text color for 'close preview'

Change-Id: Ife6f2665eabeefd6125a53318404dbd7b9af42ee
(cherry picked from commit b5f9fdff49e690cffa5318bee9d5c09f3479)

-Werror,-Wimplicit-fallthrough

Change-Id: I13a6a64f118bcfb99f47cd47a0dc638c5c9a5a14
(cherry picked from commit e64ea98801d20e5024da900a0ac8faaf565f4bf3)

Resolves: tdf#100251 gtk3 toolbar separators are white in Adwaita

Change-Id: 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/inc vcl/unx

2016-09-20 Thread Caolán McNamara
 vcl/inc/unx/gtk/gtkframe.hxx  |6 +-
 vcl/inc/unx/gtk/gtkinst.hxx   |3 +++
 vcl/unx/gtk/gtkinst.cxx   |   21 -
 vcl/unx/gtk/gtksalframe.cxx   |   16 +++-
 vcl/unx/gtk3/gtk3gtkframe.cxx |   29 +
 5 files changed, 60 insertions(+), 15 deletions(-)

New commits:
commit 2c91b27a968afb36b77e447dd623bbe81ea542f0
Author: Caolán McNamara 
Date:   Fri Sep 16 11:19:52 2016 +0100

Resolves: rhbz#1373933 gtk 3.21 emits a lot more "style-set" signals

also deb#837356

since gtk3 commit of...

commit 0f116135f4a5033ce4e9dfa19f10624701fa615c
Author: Matthias Clasen 
Date:   Fri May 6 10:12:14 2016 -0400

Avoid emitting ::style-set by name

GtkStyle is deprecated, but we still emit ::style-set quite
a bit, so lets at least not be slow while doing it.

docs say...

'GtkWidget::style-set has been deprecated since version 3.0 and should not 
be
used in newly-written code.

Use the “style-updated” signal'

and this code just came over from gtk2 without any thought about it at the
time, so change it over to the "style-updated" which makes everything happy
again

gtk3 still emits a lot of style-updateds signals

so also don't throw away font settings every time, check if the font 
settings
changed and only emit FontChanged if they differ from the last seen 
settings.

(cherry picked from commit ef7abe81df10cb8a8c04afbb1fbe700f94e73f04)

Change-Id: I9e920d2fb2d820ff1b1b5a9ecb228484df3d6146
Reviewed-on: https://gerrit.libreoffice.org/28944
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 2b5dc55..1b48aa3 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -242,7 +242,11 @@ class GtkSalFrame : public SalFrame
 
 // signals
 static gboolean signalButton( GtkWidget*, GdkEventButton*, gpointer );
-static void signalStyleSet( GtkWidget*, GtkStyle* pPrevious, 
gpointer );
+#if GTK_CHECK_VERSION(3,0,0)
+static void signalStyleUpdated(GtkWidget*, gpointer);
+#else
+static void signalStyleSet(GtkWidget*, GtkStyle* pPrevious, 
gpointer);
+#endif
 #if GTK_CHECK_VERSION(3,0,0)
 static gboolean signalDraw( GtkWidget*, cairo_t *cr, gpointer );
 static void sizeAllocated(GtkWidget*, GdkRectangle *pAllocation, 
gpointer frame);
diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index 6212d5d..f1ee273 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -239,6 +239,8 @@ public:
 #endif
 
 virtual const cairo_font_options_t* GetCairoFontOptions() override;
+const cairo_font_options_t* GetLastSeenCairoFontOptions();
+   void ResetLastSeenCairoFontOptions();
 
 voidRemoveTimer (SalTimer *pTimer);
 
@@ -248,6 +250,7 @@ private:
 std::vector  m_aTimers;
 boolIsTimerExpired();
 boolbNeedsInit;
+cairo_font_options_t*   m_pLastCairoFontOptions;
 
 mutable std::shared_ptr m_xPrintWrapper;
 };
diff --git a/vcl/unx/gtk/gtkinst.cxx b/vcl/unx/gtk/gtkinst.cxx
index c138005..1aa17fd 100644
--- a/vcl/unx/gtk/gtkinst.cxx
+++ b/vcl/unx/gtk/gtkinst.cxx
@@ -157,6 +157,7 @@ GtkInstance::GtkInstance( SalYieldMutex* pMutex )
 : X11SalInstance( pMutex )
 #endif
 , bNeedsInit(true)
+, m_pLastCairoFontOptions(nullptr)
 {
 }
 
@@ -202,6 +203,7 @@ GtkInstance::~GtkInstance()
 while( !m_aTimers.empty() )
 delete *m_aTimers.begin();
 DeInitAtkBridge();
+ResetLastSeenCairoFontOptions();
 }
 
 SalFrame* GtkInstance::CreateFrame( SalFrame* pParent, SalFrameStyleFlags 
nStyle )
@@ -477,7 +479,24 @@ GtkInstance::getPrintWrapper() const
 
 const cairo_font_options_t* GtkInstance::GetCairoFontOptions()
 {
-return gdk_screen_get_font_options(gdk_screen_get_default());
+const cairo_font_options_t* pCairoFontOptions = 
gdk_screen_get_font_options(gdk_screen_get_default());
+if (!m_pLastCairoFontOptions && pCairoFontOptions)
+m_pLastCairoFontOptions = cairo_font_options_copy(pCairoFontOptions);
+return pCairoFontOptions;
+}
+
+const cairo_font_options_t* GtkInstance::GetLastSeenCairoFontOptions()
+{
+return m_pLastCairoFontOptions;
+}
+
+void GtkInstance::ResetLastSeenCairoFontOptions()
+{
+if (m_pLastCairoFontOptions)
+{
+cairo_font_options_destroy(m_pLastCairoFontOptions);
+m_pLastCairoFontOptions = nullptr;
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index 031170b..c8c3869 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/inc vcl/unx

2016-09-11 Thread Caolán McNamara
 vcl/inc/unx/gtk/gtksalmenu.hxx |1 +
 vcl/unx/gtk/gtksalmenu.cxx |8 
 2 files changed, 9 insertions(+)

New commits:
commit 571c187f0610f59573b5e2285b6bfc9589236532
Author: Caolán McNamara 
Date:   Thu Sep 8 16:36:59 2016 +0100

Resolves: tdf#101881 gtk3 3.18 menubar doesn't grab keyboard...

the same way gtk3 3.20 does with gtk_grab_add, so on gtk_menu_shell_deselect
the keyboard focus doesn't remain in the menubar.

bisecting gtk itself I find...

commit 5cbbb90e311d95192d1b68ba89c3190cdb652868
Author: Carlos Garnacho 
Date:   Thu Nov 26 19:54:31 2015 +0100

GtkCellRendererAccel: Use gdk_seat_grab()

https://bugzilla.gnome.org/show_bug.cgi?id=759309

is the commit that makes it do what I want, so add an extra
gtk_grab_add/gtk_grab_remove around our entry and exit of the menubar

Change-Id: I5bf09834b4e1a14d30403208d03b3abd28a382a8
(cherry picked from commit d45d8ae3c51606eb1d9e63396a0eab13c8742907)
Reviewed-on: https://gerrit.libreoffice.org/28759
Tested-by: Jenkins 
Reviewed-by: Maxim Monastirsky 

diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx
index 90fcb7d..08b4113 100644
--- a/vcl/inc/unx/gtk/gtksalmenu.hxx
+++ b/vcl/inc/unx/gtk/gtksalmenu.hxx
@@ -48,6 +48,7 @@ private:
 boolmbMenuBar;
 boolmbNeedsUpdate;
 boolmbReturnFocusToDocument;
+boolmbAddedGrab;
 GtkWidget*  mpMenuBarContainerWidget;
 GtkWidget*  mpMenuBarWidget;
 GtkWidget*  mpCloseButton;
diff --git a/vcl/unx/gtk/gtksalmenu.cxx b/vcl/unx/gtk/gtksalmenu.cxx
index 2980ac0..c891cf3 100644
--- a/vcl/unx/gtk/gtksalmenu.cxx
+++ b/vcl/unx/gtk/gtksalmenu.cxx
@@ -423,6 +423,7 @@ GtkSalMenu::GtkSalMenu( bool bMenuBar ) :
 mbMenuBar( bMenuBar ),
 mbNeedsUpdate( false ),
 mbReturnFocusToDocument( false ),
+mbAddedGrab( false ),
 mpMenuBarContainerWidget( nullptr ),
 mpMenuBarWidget( nullptr ),
 mpCloseButton( nullptr ),
@@ -602,6 +603,11 @@ void GtkSalMenu::ShowCloseButton(bool bShow)
 //focus to the next pane by itself.
 void GtkSalMenu::ReturnFocus()
 {
+if (mbAddedGrab)
+{
+gtk_grab_remove(mpMenuBarWidget);
+mbAddedGrab = false;
+}
 if (!mbReturnFocusToDocument)
 gtk_widget_grab_focus(GTK_WIDGET(mpFrame->getEventBox()));
 else
@@ -661,6 +667,8 @@ bool GtkSalMenu::TakeFocus()
 
 //this pairing results in a menubar with keyboard focus with no menus
 //auto-popped down
+gtk_grab_add(mpMenuBarWidget);
+mbAddedGrab = true;
 gtk_menu_shell_select_first(GTK_MENU_SHELL(mpMenuBarWidget), false);
 gtk_menu_shell_deselect(GTK_MENU_SHELL(mpMenuBarWidget));
 mbReturnFocusToDocument = true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/inc vcl/unx

2016-07-11 Thread Caolán McNamara
 vcl/inc/unx/gtk/gtkframe.hxx  |2 ++
 vcl/unx/gtk/gtksalmenu.cxx|2 +-
 vcl/unx/gtk3/gtk3gtkframe.cxx |9 +++--
 3 files changed, 10 insertions(+), 3 deletions(-)

New commits:
commit 264a254efd60e147c4e6580f950307478f9a593f
Author: Caolán McNamara 
Date:   Mon Jun 27 11:12:20 2016 +0100

Resolves: rhbz#1342823 toolbar menus popdown immediately

Change-Id: I9cecf50fb85d84e108ccc23d22bf97d2ac510a9b
(cherry picked from commit f7c888994db744396c69aa1be720c2089ada5798)
Reviewed-on: https://gerrit.libreoffice.org/26698
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 4677923..2b5dc55 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -538,6 +538,8 @@ public:
 
 static void KeyCodeToGdkKey(const vcl::KeyCode& rKeyCode,
 guint* pGdkKeyCode, GdkModifierType *pGdkModifiers);
+
+static guint32  GetLastInputEventTime();
 };
 
 #define OOO_TYPE_FIXED ooo_fixed_get_type()
diff --git a/vcl/unx/gtk/gtksalmenu.cxx b/vcl/unx/gtk/gtksalmenu.cxx
index 2e44f76..873ce39 100644
--- a/vcl/unx/gtk/gtksalmenu.cxx
+++ b/vcl/unx/gtk/gtksalmenu.cxx
@@ -360,7 +360,7 @@ bool GtkSalMenu::ShowNativePopupMenu(FloatingWindow* pWin, 
const Rectangle& rRec
 else
 {
 nButton = 0;
-nTime = gtk_get_current_event_time();
+nTime = GtkSalFrame::GetLastInputEventTime();
 }
 
 VclPtr xParent = pWin->ImplGetWindowImpl()->mpRealParent;
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 2320356..e8d12e3 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -2018,6 +2018,11 @@ void GtkSalFrame::SetAlwaysOnTop( bool bOnTop )
 
 static guint32 nLastUserInputTime = GDK_CURRENT_TIME;
 
+guint32 GtkSalFrame::GetLastInputEventTime()
+{
+return nLastUserInputTime;
+}
+
 static void UpdateLastInputEventTime(guint32 nUserInputTime)
 {
 nLastUserInputTime = nUserInputTime;
@@ -2032,9 +2037,9 @@ void GtkSalFrame::ToTop( SalFrameToTop nFlags )
 else if( IS_WIDGET_MAPPED( m_pWindow ) )
 {
 if (!(nFlags & SalFrameToTop::GrabFocusOnly))
-gtk_window_present_with_time(GTK_WINDOW(m_pWindow), 
nLastUserInputTime);
+gtk_window_present_with_time(GTK_WINDOW(m_pWindow), 
GetLastInputEventTime());
 else
-gdk_window_focus(widget_get_window(m_pWindow), 
nLastUserInputTime);
+gdk_window_focus(widget_get_window(m_pWindow), 
GetLastInputEventTime());
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/inc vcl/unx

2016-06-16 Thread Stephan Bergmann
 vcl/inc/unx/gtk/gtkinst.hxx |6 +-
 vcl/unx/gtk/gtkinst.cxx |   16 ++--
 2 files changed, 15 insertions(+), 7 deletions(-)

New commits:
commit 81ed73d0867e0322b450314c474fd01404671f0e
Author: Stephan Bergmann 
Date:   Thu Jun 16 13:05:40 2016 +0200

tdf#100412: Cope with recursive gdk_threads_enter/_leave

07157e644fa9666850767ff6bd54c1511167a0a2 "Keep track of ThreadsEnter/Leave
acquire counts per thread" was done under the assumption that these calls 
never
happen recursively, but tdf#100412 makes it look like such calls do happen, 
so
that in a pattern

  gdk_threads_enter
  gdk_threads_enter
  gdk_threads_leave
  gdk_threads_leave

the second gdk_threads_leave could find yieldCount non-zero.

Change-Id: If9837764d22473f21cf5b10d769929f3c86a0ba7
(cherry picked from commit ef1dc167cd3339b1e92d8e18b1f5c3c2cfbec6ab)
Reviewed-on: https://gerrit.libreoffice.org/26365
Reviewed-by: Michael Stahl 
Tested-by: Jenkins 

diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index 86002fa..6212d5d 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -20,6 +20,10 @@
 #ifndef INCLUDED_VCL_INC_UNX_GTK_GTKINST_HXX
 #define INCLUDED_VCL_INC_UNX_GTK_GTKINST_HXX
 
+#include 
+
+#include 
+
 #include 
 #include 
 #include 
@@ -42,7 +46,7 @@ class GtkPrintWrapper;
 class GenPspGraphics;
 class GtkYieldMutex : public SalYieldMutex
 {
-thread_local static sal_uIntPtr yieldCount;
+thread_local static std::stack yieldCounts;
 
 public:
  GtkYieldMutex() {}
diff --git a/vcl/unx/gtk/gtkinst.cxx b/vcl/unx/gtk/gtkinst.cxx
index a37102e..c138005 100644
--- a/vcl/unx/gtk/gtkinst.cxx
+++ b/vcl/unx/gtk/gtkinst.cxx
@@ -296,22 +296,26 @@ SalPrinter* GtkInstance::CreatePrinter( SalInfoPrinter* 
pInfoPrinter )
  * for each pair, so we can accurately restore
  * it later.
  */
-thread_local sal_uIntPtr GtkYieldMutex::yieldCount;
+thread_local std::stack GtkYieldMutex::yieldCounts;
 
 void GtkYieldMutex::ThreadsEnter()
 {
 acquire();
-for (; yieldCount != 0; --yieldCount) {
-acquire();
+if (!yieldCounts.empty()) {
+auto n = yieldCounts.top();
+yieldCounts.pop();
+for (; n != 0; --n) {
+acquire();
+}
 }
 }
 
 void GtkYieldMutex::ThreadsLeave()
 {
 assert(mnCount != 0);
-assert(yieldCount == 0);
-yieldCount = mnCount - 1;
-for (sal_uIntPtr i = 0; i != yieldCount + 1; ++i) {
+auto n = mnCount - 1;
+yieldCounts.push(n);
+for (sal_uIntPtr i = 0; i != n + 1; ++i) {
 release();
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/inc vcl/unx

2016-06-09 Thread Caolán McNamara
 vcl/inc/unx/gtk/gtkframe.hxx  |1 
 vcl/unx/gtk3/gtk3gtkframe.cxx |   75 +-
 2 files changed, 32 insertions(+), 44 deletions(-)

New commits:
commit 23ba7c6c05d6331815a05a01d657f5e30b3bc252
Author: Caolán McNamara 
Date:   Thu Jun 9 11:48:19 2016 +0100

Resolves: rhbz#1344042 deb#826654 scale gtk3 smooth scaling events...

to give traditional amounts of scroll on a single mouse wheel event

ditch non smooth scroll events now seeing as apparently they are always
available so the other types are irrelevent now

if we get x and y scroll, then like macosx just dispatch x and y scroll 
events.

Note: there seems to be a bug in the stack below us where the first scroll
event after getting focus is one of a 0 x and y delta.  Because we now 
check x
and y against 0, we don't launch a scroll event in the case of a 0x0 scroll
which stops us occasionally appearing to go backwards on the first scroll 
after
getting focus. Which is the same thing I see on e.g. gedit, the first mouse
wheel scroll after getting focus doesn't actually do anything.

Change-Id: Iec8f2e4627cd84e3896270a0847a5c4907fa083f
(cherry picked from commit 0159ef4fbfd23ba97b20f97eb0677564bebd4ee7)

diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 14a9818..355910c 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -214,7 +214,6 @@ class GtkSalFrame : public SalFrame
 #if GTK_CHECK_VERSION(3,0,0)
 OUStringm_aTooltip;
 Rectangle   m_aHelpArea;
-guint32 m_nLastScrollEventTime;
 longm_nWidthRequest;
 longm_nHeightRequest;
 cairo_region_t* m_pRegion;
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 2c04616..83a4e8a 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1046,7 +1046,6 @@ void GtkSalFrame::InitCommon()
 m_bSpanMonitorsWhenFullscreen = false;
 m_nState= GDK_WINDOW_STATE_WITHDRAWN;
 m_nVisibility   = GDK_VISIBILITY_FULLY_OBSCURED;
-m_nLastScrollEventTime = GDK_CURRENT_TIME;
 m_bSendModChangeOnRelease = false;
 m_pIMHandler= nullptr;
 m_hBackgroundPixmap = None;
@@ -2634,63 +2633,53 @@ gboolean GtkSalFrame::signalButton( GtkWidget*, 
GdkEventButton* pEvent, gpointer
 
 gboolean GtkSalFrame::signalScroll( GtkWidget*, GdkEvent* pEvent, gpointer 
frame )
 {
-GtkSalFrame* pThis = static_cast(frame);
 GdkEventScroll* pSEvent = reinterpret_cast(pEvent);
+if (pSEvent->direction != GDK_SCROLL_SMOOTH)
+return false;
 
-// gnome#726878 check for duplicate legacy scroll event
-if (pSEvent->direction != GDK_SCROLL_SMOOTH &&
-pThis->m_nLastScrollEventTime == pSEvent->time)
-{
-return true;
-}
+GtkSalFrame* pThis = static_cast(frame);
 
 SalWheelMouseEvent aEvent;
 
 aEvent.mnTime = pSEvent->time;
 aEvent.mnX = (sal_uLong)pSEvent->x;
+// --- RTL --- (mirror mouse pos)
+if (AllSettings::GetLayoutRTL())
+aEvent.mnX = pThis->maGeometry.nWidth - 1 - aEvent.mnX;
 aEvent.mnY = (sal_uLong)pSEvent->y;
 aEvent.mnCode = GetMouseModCode( pSEvent->state );
-aEvent.mnScrollLines = 3;
 
-switch (pSEvent->direction)
+// rhbz#1344042 "Traditionally" in gtk3 we tool a single up/down event as
+// equating to 3 scroll lines and a delta of 120. So scale the delta here
+// by 120 where a single mouse wheel click is an incoming delta_x of 1
+// and divide that by 40 to get the number of scrollines
+if (pSEvent->delta_x != 0.0)
 {
-case GDK_SCROLL_SMOOTH:
-{
-//pick the bigger one I guess
-aEvent.mbHorz = fabs(pSEvent->delta_x) > fabs(pSEvent->delta_y);
-if (aEvent.mbHorz)
-aEvent.mnDelta = -pSEvent->delta_x * 40;
-else
-aEvent.mnDelta = -pSEvent->delta_y * 40;
+aEvent.mnDelta = -pSEvent->delta_x * 120;
+aEvent.mnNotchDelta = aEvent.mnDelta < 0 ? -1 : +1;
+if (aEvent.mnDelta == 0)
+aEvent.mnDelta = aEvent.mnNotchDelta;
+aEvent.mbHorz = true;
+aEvent.mnScrollLines = abs(aEvent.mnDelta) / 40;
+if (aEvent.mnScrollLines == 0)
 aEvent.mnScrollLines = 1;
-pThis->m_nLastScrollEventTime = pSEvent->time;
-break;
-}
-case GDK_SCROLL_UP:
-aEvent.mnDelta = 120;
-aEvent.mbHorz = false;
-break;
-case GDK_SCROLL_DOWN:
-aEvent.mnDelta = -120;
-aEvent.mbHorz = false;
-break;
-case GDK_SCROLL_LEFT:
-aEvent.mbHorz = true;
-aEvent.mnDelta = 120;
-

[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/inc vcl/unx

2016-05-31 Thread Caolán McNamara
 vcl/inc/unx/gtk/gtksalmenu.hxx |2 ++
 vcl/unx/gtk/gtksalmenu.cxx |   14 ++
 2 files changed, 16 insertions(+)

New commits:
commit 80fc481496f9d15fb01cccadfdaea9edb9724251
Author: Caolán McNamara 
Date:   Tue May 31 12:23:12 2016 +0100

gtk3: crash on reusing a popup menu that has a sub menu

Typically popup menus are created froms scratch each time, which is why
this wasn't a common problem.

To reproduce, under gtk3, set a template as default in the template manager,
reset it using dropdown, now set another template as default, and reopen the
menu.. it crashes

Change-Id: I6107fbd921ada71ef7d676031651deb4b1b2d2fb
(cherry picked from commit 446d33c39fdabff117b1228e087d037b048fd1f2)

diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx
index 31622fa..ad3e1d9 100644
--- a/vcl/inc/unx/gtk/gtksalmenu.hxx
+++ b/vcl/inc/unx/gtk/gtksalmenu.hxx
@@ -112,6 +112,8 @@ public:
 virtual voidUpdate() override;  // Update this menu only.
 // Update full menu hierarchy from this menu.
 voidUpdateFull () { 
ActivateAllSubmenus(mpVCLMenu); Update(); }
+// Clear ActionGroup and MenuModel from full menu hierarchy
+voidClearActionGroupAndMenuModel();
 GtkSalMenu* GetTopLevel();
 voidSetNeedsUpdate();
 
diff --git a/vcl/unx/gtk/gtksalmenu.cxx b/vcl/unx/gtk/gtksalmenu.cxx
index 6a8d52a..414b6b0 100644
--- a/vcl/unx/gtk/gtksalmenu.cxx
+++ b/vcl/unx/gtk/gtksalmenu.cxx
@@ -400,6 +400,7 @@ bool GtkSalMenu::ShowNativePopupMenu(FloatingWindow* pWin, 
const Rectangle& rRec
 gtk_widget_destroy(pWidget);
 
 g_object_unref(mpActionGroup);
+ClearActionGroupAndMenuModel();
 
 return true;
 #else
@@ -1003,6 +1004,19 @@ void GtkSalMenu::ActivateAllSubmenus(Menu* pMenuBar)
 }
 }
 
+void GtkSalMenu::ClearActionGroupAndMenuModel()
+{
+SetMenuModel(nullptr);
+mpActionGroup = nullptr;
+for (GtkSalMenuItem* pSalItem : maItems)
+{
+if ( pSalItem->mpSubMenu != nullptr )
+{
+pSalItem->mpSubMenu->ClearActionGroupAndMenuModel();
+}
+}
+}
+
 void GtkSalMenu::Activate(const gchar* pCommand)
 {
 MenuAndId aMenuAndId = decode_command(pCommand);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits