[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2019-02-01 Thread Libreoffice Gerrit user
 vcl/unx/gtk3_kde5/kde5_filepicker.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit f8bef86cc88e99b32e223b2bd675959c6d8e46ad
Author: Michael Weghorn 
AuthorDate: Thu Jan 31 09:52:51 2019 +0100
Commit: Thorsten Behrens 
CommitDate: Fri Feb 1 09:32:41 2019 +0100

tdf#123077 gtk3_kde5: Set KFileWidget's custom widget only once

Since the event filter is only used to set the custom
widget in the KFileWidget, it can and needs to be removed
again once this has been done; which also avoids crashes.

(s. https://gerrit.libreoffice.org/#/c/67185/ for more
infos, where the same thing is done for kde5)

Change-Id: I5c719fb17510916b4730ed5c00bb638df2f183e3
Reviewed-on: https://gerrit.libreoffice.org/67184
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
(cherry picked from commit 30cc54a4532a732a0cf6dfe9943521978ff7292f)
Reviewed-on: https://gerrit.libreoffice.org/67204
Reviewed-by: Thorsten Behrens 

diff --git a/vcl/unx/gtk3_kde5/kde5_filepicker.cxx 
b/vcl/unx/gtk3_kde5/kde5_filepicker.cxx
index 42e278aa3d0e..804aaa67e66a 100644
--- a/vcl/unx/gtk3_kde5/kde5_filepicker.cxx
+++ b/vcl/unx/gtk3_kde5/kde5_filepicker.cxx
@@ -241,7 +241,11 @@ bool KDE5FilePicker::eventFilter(QObject* o, QEvent* e)
 {
 KWindowSystem::setMainWindow(w, _winId);
 if (auto* fileWidget = w->findChild({}, 
Qt::FindDirectChildrenOnly))
+{
 fileWidget->setCustomWidget(_extraControls);
+// remove event filter again; the only purpose was to set the 
custom widget here
+qApp->removeEventFilter(this);
+}
 }
 }
 return QObject::eventFilter(o, e);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2019-01-30 Thread Libreoffice Gerrit user
 vcl/unx/gtk3/gtk3gtkinst.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit f2a39ac20f0d79e169fb4b403fbddea268c72266
Author: Michael Stahl 
AuthorDate: Tue Jan 29 18:39:25 2019 +0100
Commit: Thorsten Behrens 
CommitDate: Wed Jan 30 20:22:27 2019 +0100

vcl: fix deadlock in VclGtkClipboard::setContents()

Must not call getTransferDataFlavors with m_Mutex held;

6  TransferableHelper::getTransferDataFlavors() (this=0x567b980) at 
svtools/source/misc/transfer.cxx:392
7  
VclGtkClipboard::setContents(com::sun::star::uno::Reference
 const&, 
com::sun::star::uno::Reference
 const&) (this=0x3199550, xTrans=uno::Reference to (SwTransferable *) 
0x567b9a8, xClipboardOwner=uno::Reference to (SwTransferable *) 0x567b9b0) at 
vcl/unx/gtk3_kde5/../gtk3/gtk3gtkinst.cxx:618
8  TransferableHelper::CopyToSelection(vcl::Window*) const (this=0x567b980, 
pWindow=0x301b0c0) at svtools/source/misc/transfer.cxx:960

CopyToSelection() uses SolarMutexReleaser, then getTransferDataFlavors()
has a SolarMutexGuard; this will deadlock against the main thread
that holds SolarMutex and calls VclGtkClipboard::setContents() itself,
from VclGtkClipboard::OwnerPossiblyChanged().

Change-Id: Ibda0b6bce6f3388c45cee8077dd977abb3dda366
Reviewed-on: https://gerrit.libreoffice.org/67121
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 9286cebdff378a19ec146183676c6da96aac77db)
Reviewed-on: https://gerrit.libreoffice.org/67154
Reviewed-by: Thorsten Behrens 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index e5b1cdf4f1d6..bd221af10cdb 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -606,6 +606,12 @@ void VclGtkClipboard::setContents(
 const Reference< css::datatransfer::XTransferable >& xTrans,
 const Reference< css::datatransfer::clipboard::XClipboardOwner >& 
xClipboardOwner )
 {
+css::uno::Sequence aFormats;
+if (xTrans.is())
+{
+aFormats = xTrans->getTransferDataFlavors();
+}
+
 osl::ClearableMutexGuard aGuard( m_aMutex );
 Reference< datatransfer::clipboard::XClipboardOwner > xOldOwner( m_aOwner 
);
 Reference< datatransfer::XTransferable > xOldContents( m_aContents );
@@ -624,7 +630,6 @@ void VclGtkClipboard::setContents(
 assert(m_aGtkTargets.empty());
 if (m_aContents.is())
 {
-css::uno::Sequence aFormats = 
xTrans->getTransferDataFlavors();
 std::vector 
aGtkTargets(m_aConversionHelper.FormatsToGtk(aFormats));
 if (!aGtkTargets.empty())
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2019-01-29 Thread Libreoffice Gerrit user
 vcl/unx/generic/printer/printerinfomanager.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 228dbf7ec113918bbd9e9616c5647410a824af5f
Author: Michael Stahl 
AuthorDate: Wed Jan 23 16:23:18 2019 +0100
Commit: Katarina Behrens 
CommitDate: Tue Jan 29 20:32:57 2019 +0100

vcl: unx: apply configuration to "Generic Printer" so it's PDF ...

... by default, instead of leaving it with
m_nPSLevel == 0 && m_nPDFDevice == 0.

Change-Id: I44059ac39791442602cbc48582670d98edc578ee
Reviewed-on: https://gerrit.libreoffice.org/66802
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit c8dd1c22d7512d4922461350c6cb804cd0864e0b)
Reviewed-on: https://gerrit.libreoffice.org/67064
Reviewed-by: Thorsten Behrens 
Reviewed-by: Katarina Behrens 

diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx 
b/vcl/unx/generic/printer/printerinfomanager.cxx
index 35ac2902fc37..f3494b84c030 100644
--- a/vcl/unx/generic/printer/printerinfomanager.cxx
+++ b/vcl/unx/generic/printer/printerinfomanager.cxx
@@ -461,6 +461,9 @@ void PrinterInfoManager::initialize()
 
 setDefaultPaper( aPrinter.m_aInfo.m_aContext );
 
+// if it's a "Generic Printer", apply defaults from config...
+aPrinter.m_aInfo.resolveDefaultBackend();
+
 // finally insert printer
 FileBase::getFileURLFromSystemPath( aFile.PathToFileName(), 
aPrinter.m_aFile );
 aPrinter.m_bModified= false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2019-01-29 Thread Libreoffice Gerrit user
 vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx |   53 ++
 1 file changed, 47 insertions(+), 6 deletions(-)

New commits:
commit 36d5fd037439f84a688b96ec5af9e47d4a58712e
Author: Caolán McNamara 
AuthorDate: Thu Jan 24 09:14:59 2019 +
Commit: Caolán McNamara 
CommitDate: Tue Jan 29 11:02:08 2019 +0100

Resolves: tdf#122662 restore context after changing state

otherwise we may change a context which get reused by gtk for rendering
something we don't ourselves draw directly

Change-Id: I814140cd63489f7e4fac47a7486a006a4aa1fac5
Reviewed-on: https://gerrit.libreoffice.org/66849
Tested-by: Jenkins
Tested-by: Xisco Faulí 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx 
b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 9ed8d7c96dc3..ac3ab4f2975a 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -384,19 +384,37 @@ static GtkWidget* gTreeViewWidget;
 
 namespace
 {
-void parent_styles_context_set_state(GtkStyleContext* context, 
GtkStateFlags flags)
+void style_context_set_state(GtkStyleContext* context, GtkStateFlags flags)
 {
-while ((context = gtk_style_context_get_parent(context)))
+do
 {
 gtk_style_context_set_state(context, flags);
 }
+while ((context = gtk_style_context_get_parent(context)));
 }
 
-void style_context_set_state(GtkStyleContext* context, GtkStateFlags flags)
+class StyleContextSave
 {
-gtk_style_context_set_state(context, flags);
-parent_styles_context_set_state(context, flags);
-}
+private:
+std::vector> m_aStates;
+public:
+void save(GtkStyleContext* context)
+{
+do
+{
+m_aStates.emplace_back(context, 
gtk_style_context_get_state(context));
+}
+while ((context = gtk_style_context_get_parent(context)));
+}
+void restore()
+{
+for (auto a = m_aStates.rbegin(); a != m_aStates.rend(); ++a)
+{
+gtk_style_context_set_state(a->first, a->second);
+}
+m_aStates.clear();
+}
+};
 
 tools::Rectangle render_common(GtkStyleContext *pContext, cairo_t *cr, 
const tools::Rectangle , GtkStateFlags flags)
 {
@@ -2406,6 +2424,8 @@ bool GtkSalGraphics::drawNativeControl( ControlType 
nType, ControlPart nPart, co
 long nWidth = rControlRegion.GetWidth();
 long nHeight = rControlRegion.GetHeight();
 
+StyleContextSave aContextState;
+aContextState.save(context);
 style_context_set_state(context, flags);
 
 if (styleClass)
@@ -2561,6 +2581,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType 
nType, ControlPart nPart, co
 {
 gtk_style_context_remove_class(context, styleClass);
 }
+aContextState.restore();
 
 cairo_destroy(cr); // unref
 
@@ -2852,6 +2873,8 @@ vcl::Font pango_to_vcl(const PangoFontDescription* font, 
const css::lang::Locale
 void GtkSalGraphics::updateSettings( AllSettings& rSettings )
 {
 GtkStyleContext* pStyle = gtk_widget_get_style_context( mpWindow );
+StyleContextSave aContextState;
+aContextState.save(pStyle);
 GtkSettings* pSettings = gtk_widget_get_settings( mpWindow );
 StyleSettings aStyleSet = rSettings.GetStyleSettings();
 GdkRGBA color;
@@ -2891,9 +2914,12 @@ void GtkSalGraphics::updateSettings( AllSettings& 
rSettings )
 aTextColor = getColor( text_color );
 aStyleSet.SetFieldRolloverTextColor( aTextColor );
 
+aContextState.restore();
+
 // button mouse over colors
 {
 GdkRGBA normal_button_rollover_text_color, 
pressed_button_rollover_text_color;
+aContextState.save(mpButtonStyle);
 style_context_set_state(mpButtonStyle, GTK_STATE_FLAG_PRELIGHT);
 gtk_style_context_get_color(mpButtonStyle, 
gtk_style_context_get_state(mpButtonStyle), _button_rollover_text_color);
 aTextColor = getColor(normal_button_rollover_text_color);
@@ -2903,6 +2929,7 @@ void GtkSalGraphics::updateSettings( AllSettings& 
rSettings )
 aTextColor = getColor(pressed_button_rollover_text_color);
 style_context_set_state(mpButtonStyle, GTK_STATE_FLAG_NORMAL);
 aStyleSet.SetButtonPressedRolloverTextColor( aTextColor );
+aContextState.restore();
 }
 
 // tooltip colors
@@ -2987,6 +3014,8 @@ void GtkSalGraphics::updateSettings( AllSettings& 
rSettings )
 aStyleSet.SetSkipDisabledInMenus( true );
 aStyleSet.SetPreferredContextMenuShortcuts( false );
 
+aContextState.save(mpMenuItemLabelStyle);
+
 // menu colors
 style_context_set_state(mpMenuStyle, GTK_STATE_FLAG_NORMAL);
 gtk_style_context_get_background_color( mpMenuStyle, 
gtk_style_context_get_state(mpMenuStyle), _color );
@@ -3026,47 +3055,59 @@ void 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2019-01-11 Thread Libreoffice Gerrit user
 vcl/unx/generic/printer/ppdparser.cxx |   21 +++--
 1 file changed, 15 insertions(+), 6 deletions(-)

New commits:
commit f100b106a52561f8a1934b4c3198712d7e9c464f
Author: Caolán McNamara 
AuthorDate: Wed Nov 28 12:23:38 2018 +
Commit: Miklos Vajna 
CommitDate: Fri Jan 11 16:36:41 2019 +0100

Resolves: tdf#112215 null deref on missing optional ppd value

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

diff --git a/vcl/unx/generic/printer/ppdparser.cxx 
b/vcl/unx/generic/printer/ppdparser.cxx
index af2dfbe0e249..7668701f91cb 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -852,13 +852,22 @@ PPDParser::PPDParser( const OUString& rFile ) :
 }
 
 // fill in direct values
-if( (pKey = getKey( OUString( "ColorDevice" ) )) )
-m_bColorDevice = pKey->getValue( 0 
)->m_aValue.startsWithIgnoreAsciiCase( "true" );
+if ((pKey = getKey(OUString("ColorDevice"
+{
+if (const PPDValue* pValue = pKey->getValue(0))
+m_bColorDevice = 
pValue->m_aValue.startsWithIgnoreAsciiCase("true");
+}
 
-if( (pKey = getKey( OUString( "LanguageLevel" ) )) )
-m_nLanguageLevel = pKey->getValue( 0 )->m_aValue.toInt32();
-if( (pKey = getKey( OUString( "TTRasterizer" ) )) )
-m_bType42Capable = pKey->getValue( 0 
)->m_aValue.equalsIgnoreAsciiCase( "Type42" );
+if ((pKey = getKey(OUString("LanguageLevel"
+{
+if (const PPDValue* pValue = pKey->getValue(0))
+m_nLanguageLevel = pValue->m_aValue.toInt32();
+}
+if ((pKey = getKey(OUString("TTRasterizer"
+{
+if (const PPDValue* pValue = pKey->getValue(0))
+m_bType42Capable = pValue->m_aValue.equalsIgnoreAsciiCase( 
"Type42" );
+}
 }
 
 PPDParser::~PPDParser()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-12-20 Thread Libreoffice Gerrit user
 vcl/unx/gtk/gtksalmenu.cxx |   14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit c72ddb5e185d33e17762bc96207b86948950e173
Author: Caolán McNamara 
AuthorDate: Wed Dec 19 16:23:06 2018 +
Commit: Caolán McNamara 
CommitDate: Thu Dec 20 12:10:29 2018 +0100

Resolves: tdf#121555 sometime crash on menu hierarchy change

seems menubar gets set to dirty due to some menu activity that needs
a refresh, but then the hierarchy changes and as its already dirty
the maUpdateMenuBarIdle doesn't get launched

the placement of the mbMenuBar test inside the loop through parents
shows some confusion as to what which mbMenuBar might be met, the
one belonging to this, or that of the parent being traversed, but
it does seem to be the one belonging to this.

Change-Id: I0b9dceadf64f7adf18eb1aa2dbda9bbfbcb66e0a
Reviewed-on: https://gerrit.libreoffice.org/65465
Tested-by: Jenkins
Tested-by: Xisco Faulí 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/unx/gtk/gtksalmenu.cxx b/vcl/unx/gtk/gtksalmenu.cxx
index 8fd2ea29636a..c946ae0d32d4 100644
--- a/vcl/unx/gtk/gtksalmenu.cxx
+++ b/vcl/unx/gtk/gtksalmenu.cxx
@@ -226,8 +226,12 @@ void GtkSalMenu::ImplUpdate(bool bRecurse, bool 
bRemoveDisabledEntries)
 if (mbNeedsUpdate)
 {
 mbNeedsUpdate = false;
-if (mbMenuBar)
+if (mbMenuBar && maUpdateMenuBarIdle.IsActive())
+{
 maUpdateMenuBarIdle.Stop();
+maUpdateMenuBarIdle.Invoke();
+return;
+}
 }
 
 Menu* pVCLMenu = mpVCLMenu;
@@ -520,13 +524,17 @@ IMPL_LINK_NOARG(GtkSalMenu, 
MenuBarHierarchyChangeHandler, Timer *, void)
 void GtkSalMenu::SetNeedsUpdate()
 {
 GtkSalMenu* pMenu = this;
+// start that the menu and its parents are in need of an update
+// on the next activation
 while (pMenu && !pMenu->mbNeedsUpdate)
 {
 pMenu->mbNeedsUpdate = true;
-if (mbMenuBar)
-maUpdateMenuBarIdle.Start();
 pMenu = pMenu->mpParentSalMenu;
 }
+// only if a menubar is directly updated do we force in a full
+// structure update
+if (mbMenuBar && !maUpdateMenuBarIdle.IsActive())
+maUpdateMenuBarIdle.Start();
 }
 
 void GtkSalMenu::SetMenuModel(GMenuModel* pMenuModel)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-12-07 Thread Libreoffice Gerrit user
 vcl/unx/gtk3_kde5/kde5_filepicker_ipc.cxx |   12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 626ebc8d81d684d3a845ff787fbaaf416df7e427
Author: Michael Weghorn 
AuthorDate: Tue Dec 4 14:42:31 2018 +0100
Commit: Thorsten Behrens 
CommitDate: Sat Dec 8 01:04:23 2018 +0100

tdf#121399 Join cmd reading thread in gtk3_kde5

Stop reading commands from the pipe on kde5 side once
the "Quit" command has been sent, in order to have
the thread that is reading commands from stdin finish
properly.

Join the thread in the 'FilePickerIpc' destructor, rather than
just deleting it while it may still be running, which
resulted in 'terminate()' being called.

Change-Id: Ia184987e7994cc1de0208ff2757a3cf06c8b7194
Reviewed-on: https://gerrit.libreoffice.org/63835
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
(cherry picked from commit 93815c2b04f1905e43c695caf5cc2c594bb897ce)
Reviewed-on: https://gerrit.libreoffice.org/64588
Reviewed-by: Thorsten Behrens 

diff --git a/vcl/unx/gtk3_kde5/kde5_filepicker_ipc.cxx 
b/vcl/unx/gtk3_kde5/kde5_filepicker_ipc.cxx
index 803e5bedd853..4d7aff80c27c 100644
--- a/vcl/unx/gtk3_kde5/kde5_filepicker_ipc.cxx
+++ b/vcl/unx/gtk3_kde5/kde5_filepicker_ipc.cxx
@@ -192,6 +192,12 @@ void readCommands(FilePickerIpc* ipc)
 readCommandArgs(command, args);
 
 emit ipc->commandReceived(messageId, command, args);
+
+// stop processing once 'Quit' command has been sent
+if (command == Commands::Quit)
+{
+return;
+}
 }
 }
 
@@ -211,7 +217,11 @@ FilePickerIpc::FilePickerIpc(KDE5FilePicker* filePicker, 
QObject* parent)
 m_ipcReaderThread = std::unique_ptr{ new 
std::thread(readCommands, this) };
 }
 
-FilePickerIpc::~FilePickerIpc() = default;
+FilePickerIpc::~FilePickerIpc()
+{
+// join thread that reads commands
+m_ipcReaderThread->join();
+};
 
 bool FilePickerIpc::handleCommand(uint64_t messageId, Commands command, 
QList args)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-12-06 Thread Libreoffice Gerrit user
 vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit ec01cd7a2263922f2aaab6bee8aa826fb67cc7ea
Author: Michael Weghorn 
AuthorDate: Tue Dec 4 09:24:32 2018 +0100
Commit: Katarina Behrens 
CommitDate: Thu Dec 6 16:03:29 2018 +0100

tdf#121892 Guard Gtk3KDE5FilePicker::execute with SolarMutexGuard

Adhere to what gtk3's file picker does as well.
Threading is involved in Gtk3KDE5FilePickerIpc::execute().

Change-Id: I4fa0a12f46ed13ef04211cb8577e77d1db5e8eae
Reviewed-on: https://gerrit.libreoffice.org/64502
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
(cherry picked from commit 8dbe0af729c9e054135a0f41706165033441f867)
Reviewed-on: https://gerrit.libreoffice.org/64586
Reviewed-by: Katarina Behrens 

diff --git a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx 
b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx
index 919328dd9d6c..8006bc37c7dc 100644
--- a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx
+++ b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker.cxx
@@ -94,7 +94,11 @@ void SAL_CALL Gtk3KDE5FilePicker::setTitle(const OUString& 
title)
 m_ipc.sendCommand(Commands::SetTitle, title);
 }
 
-sal_Int16 SAL_CALL Gtk3KDE5FilePicker::execute() { return m_ipc.execute(); }
+sal_Int16 SAL_CALL Gtk3KDE5FilePicker::execute()
+{
+SolarMutexGuard g;
+return m_ipc.execute();
+}
 
 void SAL_CALL Gtk3KDE5FilePicker::setMultiSelectionMode(sal_Bool multiSelect)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-11-27 Thread Libreoffice Gerrit user
 vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx |9 +
 1 file changed, 9 insertions(+)

New commits:
commit 4846848941241f92b32bcffef3489736d1baffec
Author: Caolán McNamara 
AuthorDate: Thu Nov 8 09:58:58 2018 +
Commit: Christian Lohmaier 
CommitDate: Tue Nov 27 12:49:01 2018 +0100

Resolves: tdf#119790 for gtk3 save and restore typed name on changing filter

Change-Id: I17c3d154144b13ce401b0e4afe84c91a2fe98d8e
Reviewed-on: https://gerrit.libreoffice.org/63076
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 

diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx 
b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
index 16a845eabe81..75458dae1a13 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
@@ -807,7 +807,16 @@ uno::Sequence SAL_CALL 
SalGtkFilePicker::getSelectedFiles()
 }
 }
 if( bChangeFilter && bExtensionTypedIn )
+{
+#if GTK_CHECK_VERSION(3,0,0)
+gchar* pCurrentName = 
gtk_file_chooser_get_current_name(GTK_FILE_CHOOSER(m_pDialog));
+setCurrentFilter( aNewFilter );
+
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_pDialog), pCurrentName);
+g_free(pCurrentName);
+#else
 setCurrentFilter( aNewFilter );
+#endif
+}
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-11-23 Thread Libreoffice Gerrit user
 vcl/unx/gtk3/gtk3gtkinst.cxx |   19 +++
 1 file changed, 19 insertions(+)

New commits:
commit 3760cfe1cb146bf99077579a5d3939a6b668a7d4
Author: Caolán McNamara 
AuthorDate: Mon Nov 12 13:31:13 2018 +
Commit: Eike Rathke 
CommitDate: Fri Nov 23 12:33:49 2018 +0100

honor getNumDecimalSep for keypad input in native gtk3 dialogs

Change-Id: Ibbd37f18ee97eb6ded0ab90cd70b777ffd20f91d
Reviewed-on: https://gerrit.libreoffice.org/63292
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index ee3dc615243a..e5b1cdf4f1d6 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1182,6 +1182,7 @@ private:
 bool m_bTakeOwnership;
 gulong m_nFocusInSignalId;
 gulong m_nFocusOutSignalId;
+gulong m_nKeyPressSignalId;
 
 static void signalFocusIn(GtkWidget*, GdkEvent*, gpointer widget)
 {
@@ -1197,6 +1198,17 @@ private:
 pThis->signal_focus_out();
 }
 
+static gboolean signalKeyPress(GtkWidget*, GdkEventKey* pEvent, gpointer)
+{
+// #i1820# use locale specific decimal separator
+if (pEvent->keyval == GDK_KEY_KP_Decimal && 
Application::GetSettings().GetMiscSettings().GetEnableLocalizedDecimalSep())
+{
+OUString 
aSep(Application::GetSettings().GetLocaleDataWrapper().getNumDecimalSep());
+pEvent->keyval = aSep[0];
+}
+return false;
+}
+
 public:
 GtkInstanceWidget(GtkWidget* pWidget, bool bTakeOwnership)
 : m_pWidget(pWidget)
@@ -1204,6 +1216,11 @@ public:
 , m_nFocusInSignalId(0)
 , m_nFocusOutSignalId(0)
 {
+GdkEventMask 
eEventMask(static_cast(gtk_widget_get_events(pWidget)));
+if (eEventMask & GDK_BUTTON_PRESS_MASK)
+m_nKeyPressSignalId = g_signal_connect(pWidget, "key-press-event", 
G_CALLBACK(signalKeyPress), this);
+else
+m_nKeyPressSignalId = 0;
 }
 
 virtual void set_sensitive(bool sensitive) override
@@ -1474,6 +1491,8 @@ public:
 
 virtual ~GtkInstanceWidget() override
 {
+if (m_nKeyPressSignalId)
+g_signal_handler_disconnect(m_pWidget, m_nKeyPressSignalId);
 if (m_nFocusInSignalId)
 g_signal_handler_disconnect(m_pWidget, m_nFocusInSignalId);
 if (m_nFocusOutSignalId)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-11-12 Thread Libreoffice Gerrit user
 vcl/unx/gtk3_kde5/kde5_filepicker.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit bedd49e6b40c1a51459f9a0dfa0c0ed0d0b8ae2e
Author: Michael Weghorn 
AuthorDate: Fri Nov 9 12:21:08 2018 +0100
Commit: Caolán McNamara 
CommitDate: Mon Nov 12 13:09:39 2018 +0100

tdf#121276 gtk3_kde5: Don't prevent creating new files

This takes over for gtk3_kde5 what was done for kde5 in commit
c0f45c89063fa5c4334ff9e624d24d48638ffb4d.

Change-Id: Ieca71498bd0cc00ca07b83f6e1178d983169d5be
Reviewed-on: https://gerrit.libreoffice.org/63172
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
(cherry picked from commit a6318cb430fd8f90b760f7dc36f4eacd3904e22e)
Reviewed-on: https://gerrit.libreoffice.org/63193
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3_kde5/kde5_filepicker.cxx 
b/vcl/unx/gtk3_kde5/kde5_filepicker.cxx
index e5bdd7e2646c..42e278aa3d0e 100644
--- a/vcl/unx/gtk3_kde5/kde5_filepicker.cxx
+++ b/vcl/unx/gtk3_kde5/kde5_filepicker.cxx
@@ -88,6 +88,9 @@ bool KDE5FilePicker::execute()
 
 void KDE5FilePicker::setMultiSelectionMode(bool multiSelect)
 {
+if (_dialog->acceptMode() == QFileDialog::AcceptSave)
+return;
+
 _dialog->setFileMode(multiSelect ? QFileDialog::ExistingFiles : 
QFileDialog::ExistingFile);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-10-11 Thread Libreoffice Gerrit user
 vcl/unx/gtk3_kde5/kde5_filepicker_ipc.cxx |  229 ++
 vcl/unx/gtk3_kde5/kde5_filepicker_ipc.hxx |   18 +-
 2 files changed, 186 insertions(+), 61 deletions(-)

New commits:
commit d6391f474a94becf3a30963356515c1a1d5c434e
Author: Michael Weghorn 
AuthorDate: Tue Oct 2 16:08:35 2018 +0200
Commit: Caolán McNamara 
CommitDate: Thu Oct 11 10:04:21 2018 +0200

tdf#120261 gtk3_kde5: Read IPC cmds in own thread on kde5 side

Move reading IPC commands and arguments to those commands
to a separate thread and use the signal/slot mechanism
to notify 'FilePickerIpc' whenever a new command and its
arguments have been read.

This allows to handle the events of other commands that have been
received while the dialog is being executed.
This will be needed by a subsequent change that will modify
how IPC is handled on the gtk3 side.

Change-Id: Ia77b21045b0196710cbe164fb640b36a128d5081
Reviewed-on: https://gerrit.libreoffice.org/61252
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
(cherry picked from commit 3b36855e48f6ef3f4e52e998c52c531fe5191477)
Reviewed-on: https://gerrit.libreoffice.org/61510
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3_kde5/kde5_filepicker_ipc.cxx 
b/vcl/unx/gtk3_kde5/kde5_filepicker_ipc.cxx
index aeb864eae2ef..803e5bedd853 100644
--- a/vcl/unx/gtk3_kde5/kde5_filepicker_ipc.cxx
+++ b/vcl/unx/gtk3_kde5/kde5_filepicker_ipc.cxx
@@ -27,7 +27,6 @@
 
 #include 
 
-#include "filepicker_ipc_commands.hxx"
 #include "kde5_filepicker.hxx"
 
 #include 
@@ -53,49 +52,180 @@ void sendIpcArg(std::ostream& stream, const QStringList& 
list)
 }
 }
 
-FilePickerIpc::FilePickerIpc(KDE5FilePicker* filePicker, QObject* parent)
-: QObject(parent)
-, m_filePicker(filePicker)
-, m_stdinNotifier(new QSocketNotifier(fileno(stdin), 
QSocketNotifier::Read, this))
+void readCommandArgs(Commands command, QList& args)
 {
-connect(m_stdinNotifier, ::activated, this, 
::readCommands);
+switch (command)
+{
+case Commands::SetTitle:
+{
+QString title;
+readIpcArgs(std::cin, title);
+args.append(title);
+break;
+}
+case Commands::SetWinId:
+{
+sal_uIntPtr winId = 0;
+readIpcArgs(std::cin, winId);
+QVariant aWinIdVariant;
+aWinIdVariant.setValue(winId);
+args.append(aWinIdVariant);
+break;
+}
+case Commands::SetMultiSelectionMode:
+{
+bool multiSelection = false;
+readIpcArgs(std::cin, multiSelection);
+args.append(multiSelection);
+break;
+}
+case Commands::SetDefaultName:
+{
+QString name;
+readIpcArgs(std::cin, name);
+args.append(name);
+break;
+}
+case Commands::SetDisplayDirectory:
+{
+QString dir;
+readIpcArgs(std::cin, dir);
+args.append(dir);
+break;
+}
+case Commands::AppendFilter:
+{
+QString title, filter;
+readIpcArgs(std::cin, title, filter);
+args.append(title);
+args.append(filter);
+break;
+}
+case Commands::SetCurrentFilter:
+{
+QString title;
+readIpcArgs(std::cin, title);
+args.append(title);
+break;
+}
+case Commands::SetValue:
+{
+sal_Int16 controlId = 0;
+sal_Int16 nControlAction = 0;
+bool value = false;
+readIpcArgs(std::cin, controlId, nControlAction, value);
+args.append(controlId);
+args.append(nControlAction);
+args.append(value);
+break;
+}
+case Commands::GetValue:
+{
+sal_Int16 controlId = 0;
+sal_Int16 nControlAction = 0;
+readIpcArgs(std::cin, controlId, nControlAction);
+args.append(controlId);
+args.append(nControlAction);
+break;
+}
+case Commands::EnableControl:
+{
+sal_Int16 controlId = 0;
+bool enabled = false;
+readIpcArgs(std::cin, controlId, enabled);
+args.append(controlId);
+args.append(enabled);
+break;
+}
+case Commands::SetLabel:
+{
+sal_Int16 controlId = 0;
+QString label;
+readIpcArgs(std::cin, controlId, label);
+args.append(controlId);
+args.append(label);
+break;
+}
+case Commands::GetLabel:
+{
+sal_Int16 controlId = 0;
+readIpcArgs(std::cin, controlId);
+args.append(controlId);
+break;
+}
+case 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-10-11 Thread Libreoffice Gerrit user
 vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx |   43 +++
 vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx |   55 ++---
 2 files changed, 57 insertions(+), 41 deletions(-)

New commits:
commit c6cd5656e5b398502e55bc83c4bfc94180f72606
Author: Michael Weghorn 
AuthorDate: Tue Oct 2 16:13:51 2018 +0200
Commit: Caolán McNamara 
CommitDate: Thu Oct 11 10:04:41 2018 +0200

tdf#120261 gtk3_kde5: Leave event handling on gtk3 side to gtk

This introduces a new thread that takes care of handling the IPC
command and result for executing the file picker
('Commands::Execute'), which is the only command in the file
picker that may block for a longer time until it receives its
result from the kde5 side (namely, when the dialog has been
closed).

While the file dialog is being executed, activate a dummy GTK dialog
that also takes care of handling events in its main loop as long
as the file dialog is shown. The dummy dialog is closed together
with the KDE file dialog.
(Since the actual KDE file dialog is run as a separate process,
this one is mostly "transparent" to the soffice process from the
point of view of a dialog.)

This allows dropping the custom event processing previously done
in 'Gtk3KDE5FilePickerIpc::readResponse()' that had the potential
to cause all kinds of problems, e.g. when another event related to
the file picker was triggered from a Java process via UNO.

Change-Id: I3d663253f09320f7a8e0d9ec32a8fd6ec191c189
Reviewed-on: https://gerrit.libreoffice.org/61253
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
(cherry picked from commit 788716cebad012513cc2798589b817b86cbf1bbc)
Reviewed-on: https://gerrit.libreoffice.org/61511
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx 
b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx
index 8cec9d853fbc..36ddcaf40f6e 100644
--- a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx
+++ b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx
@@ -106,6 +106,17 @@ OUString getResString(const char* pResId)
 return VclResId(pResId);
 }
 
+// handles the IPC commands for dialog execution and ends the dummy Gtk dialog 
once the IPC response is there
+void handleIpcForExecute(Gtk3KDE5FilePickerIpc* pFilePickerIpc, GtkWidget* 
pDummyDialog,
+ bool* bResult)
+{
+auto id = pFilePickerIpc->sendCommand(Commands::Execute);
+pFilePickerIpc->readResponse(id, *bResult);
+
+// end the dummy dialog
+gtk_widget_hide(pDummyDialog);
+}
+
 // Gtk3KDE5FilePicker
 
 Gtk3KDE5FilePickerIpc::Gtk3KDE5FilePickerIpc()
@@ -143,9 +154,29 @@ sal_Int16 Gtk3KDE5FilePickerIpc::execute()
 {
 auto restoreMainWindow = blockMainWindow();
 
-auto id = sendCommand(Commands::Execute);
+// dummy gtk dialog that will take care of processing events,
+// not meant to be actually seen by user
+GtkWidget* pDummyDialog = gtk_dialog_new();
+
 bool accepted = false;
-readResponse(id, accepted);
+
+// send IPC command and read response in a separate thread
+std::thread aIpcHandler(, this, pDummyDialog, 
);
+
+// make dummy dialog not to be seen by user
+gtk_window_set_decorated(GTK_WINDOW(pDummyDialog), false);
+gtk_window_set_default_size(GTK_WINDOW(pDummyDialog), 0, 0);
+gtk_window_set_accept_focus(GTK_WINDOW(pDummyDialog), false);
+// gtk_widget_set_opacity() only has the desired effect when widget is 
already shown
+gtk_widget_show(pDummyDialog);
+gtk_widget_set_opacity(pDummyDialog, 0);
+// run dialog, leaving event processing to GTK
+// dialog will be closed by the separate 'aIpcHandler' thread once the IPC 
response is there
+gtk_dialog_run(GTK_DIALOG(pDummyDialog));
+
+aIpcHandler.join();
+
+gtk_widget_destroy(pDummyDialog);
 
 if (restoreMainWindow)
 restoreMainWindow();
@@ -204,14 +235,6 @@ std::function 
Gtk3KDE5FilePickerIpc::blockMainWindow()
 };
 }
 
-void Gtk3KDE5FilePickerIpc::await(const std::future& future)
-{
-while (future.wait_for(std::chrono::milliseconds(1)) != 
std::future_status::ready)
-{
-GetGtkSalData()->Yield(false, true);
-}
-}
-
 void Gtk3KDE5FilePickerIpc::writeResponseLine(const std::string& line)
 {
 sal_uInt64 bytesWritten = 0;
diff --git a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx 
b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx
index 90ec4e1d55ab..a9584b11fcd2 100644
--- a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx
+++ b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.hxx
@@ -30,7 +30,6 @@
 #include "filepicker_ipc_commands.hxx"
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -105,43 +104,37 @@ public:
 
 template  void readResponse(uint64_t id, Args&... args)
 {
-// read synchronously from a background thread and run the eventloop 
until the value becomes available
-

[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-10-09 Thread Libreoffice Gerrit user
 vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx |   11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

New commits:
commit 73f9100a3d3f28ebfd676b42a833bba4ba9f05f1
Author: Caolán McNamara 
AuthorDate: Tue Oct 2 12:48:26 2018 +0100
Commit: Christian Lohmaier 
CommitDate: Tue Oct 9 13:58:22 2018 +0200

filename may be null

Change-Id: I373886d3613607b8ee8e96d8c0314865f3991a92
Reviewed-on: https://gerrit.libreoffice.org/61251
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 

diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx 
b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
index e4f5ac395b8d..16a845eabe81 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
@@ -1496,17 +1496,14 @@ void SalGtkFilePicker::selection_changed_cb( 
GtkFileChooser *, SalGtkFilePicker
 
 void SalGtkFilePicker::update_preview_cb( GtkFileChooser *file_chooser, 
SalGtkFilePicker* pobjFP )
 {
-GtkWidget *preview;
-char *filename;
-GdkPixbuf *pixbuf;
 gboolean have_preview = false;
 
-preview = pobjFP->m_pPreview;
-filename = gtk_file_chooser_get_preview_filename( file_chooser );
+GtkWidget* preview = pobjFP->m_pPreview;
+char* filename = gtk_file_chooser_get_preview_filename( file_chooser );
 
-if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( 
pobjFP->m_pToggles[PREVIEW] ) ) && g_file_test( filename, 
G_FILE_TEST_IS_REGULAR ) )
+if 
(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pobjFP->m_pToggles[PREVIEW])) 
&& filename && g_file_test(filename, G_FILE_TEST_IS_REGULAR))
 {
-pixbuf = gdk_pixbuf_new_from_file_at_size(
+GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_size(
 filename,
 pobjFP->m_PreviewImageWidth,
 pobjFP->m_PreviewImageHeight, nullptr );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-10-09 Thread Libreoffice Gerrit user
 vcl/unx/gtk3/gtk3gtkframe.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 5b1d95ad0e8f898913e4324bd7196cfb76b483db
Author: Caolán McNamara 
AuthorDate: Fri Sep 28 14:27:27 2018 +0100
Commit: Christian Lohmaier 
CommitDate: Tue Oct 9 13:57:07 2018 +0200

listen to [leave|enter]-notify-event at event widget level

rather than toplevel. This avoid the problem under wayland where
with an initially maximized calc clicking in it will select all
cells from 0,0 to the clicked cell until the mouse is released

Change-Id: I138fe587c9cb7cfff0293847c00730593e3244e1
Reviewed-on: https://gerrit.libreoffice.org/61088
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index c1c560b3f9ce..b172132feb77 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1029,6 +1029,9 @@ void GtkSalFrame::InitCommon()
 m_aMouseSignalIds.push_back(g_signal_connect( G_OBJECT(pEventWidget), 
"button-press-event", G_CALLBACK(signalButton), this ));
 m_aMouseSignalIds.push_back(g_signal_connect( G_OBJECT(pEventWidget), 
"motion-notify-event", G_CALLBACK(signalMotion), this ));
 m_aMouseSignalIds.push_back(g_signal_connect( G_OBJECT(pEventWidget), 
"button-release-event", G_CALLBACK(signalButton), this ));
+m_aMouseSignalIds.push_back(g_signal_connect( G_OBJECT(pEventWidget), 
"leave-notify-event", G_CALLBACK(signalCrossing), this ));
+m_aMouseSignalIds.push_back(g_signal_connect( G_OBJECT(pEventWidget), 
"enter-notify-event", G_CALLBACK(signalCrossing), this ));
+
 
 //Drop Target Stuff
 gtk_drag_dest_set(GTK_WIDGET(pEventWidget), GtkDestDefaults(0), nullptr, 
0, GdkDragAction(0));
@@ -1068,8 +1071,6 @@ void GtkSalFrame::InitCommon()
 g_signal_connect( G_OBJECT(m_pWindow), "key-release-event", 
G_CALLBACK(signalKey), this );
 g_signal_connect( G_OBJECT(m_pWindow), "delete-event", 
G_CALLBACK(signalDelete), this );
 g_signal_connect( G_OBJECT(m_pWindow), "window-state-event", 
G_CALLBACK(signalWindowState), this );
-g_signal_connect( G_OBJECT(m_pWindow), "leave-notify-event", 
G_CALLBACK(signalCrossing), this );
-g_signal_connect( G_OBJECT(m_pWindow), "enter-notify-event", 
G_CALLBACK(signalCrossing), this );
 g_signal_connect( G_OBJECT(m_pWindow), "visibility-notify-event", 
G_CALLBACK(signalVisibility), this );
 g_signal_connect( G_OBJECT(m_pWindow), "destroy", 
G_CALLBACK(signalDestroy), this );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-09-21 Thread Libreoffice Gerrit user
 vcl/unx/gtk3_kde5/kde5_filepicker_ipc.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 4a242e736be63f4ca40963f6690d9f0619bad29a
Author: Michael Weghorn 
AuthorDate: Wed Sep 12 10:51:25 2018 +0200
Commit: Thorsten Behrens 
CommitDate: Fri Sep 21 15:18:42 2018 +0200

tdf#119814 Fix UI freeze with gtk3_kde5 filepicker

Previously, the loop inside 'runCommands()' was triggered
every time 'm_stdinNotifier' got activated.

This could lead to both the soffice and the separate
lo_kde5filepicker process blocking indefinitely, when
during the execution of 'KDE5FilePicker::execute()', the
processing of another event started which would then
be blocked in the 'readCommand()' call; finally causing
both processes to wait for input from stdin that would
never appear (s. backtrace attached to tdf#119814).

Since the loop inside 'runCommands()' runs until all
commands have been processed, it's sufficient to
start it once when 'm_stdinNotifier' is activated for the
first time.

Change-Id: Ie9180dbaf7e3f7ec033ad6d53fabe1b1ee363465
Reviewed-on: https://gerrit.libreoffice.org/60380
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
(cherry picked from commit e95930d96459cc653342e78617db9498255569d0)
Reviewed-on: https://gerrit.libreoffice.org/60407
Reviewed-by: Thorsten Behrens 

diff --git a/vcl/unx/gtk3_kde5/kde5_filepicker_ipc.cxx 
b/vcl/unx/gtk3_kde5/kde5_filepicker_ipc.cxx
index 26c19f6b4c9b..aeb864eae2ef 100644
--- a/vcl/unx/gtk3_kde5/kde5_filepicker_ipc.cxx
+++ b/vcl/unx/gtk3_kde5/kde5_filepicker_ipc.cxx
@@ -65,6 +65,9 @@ FilePickerIpc::~FilePickerIpc() = default;
 
 void FilePickerIpc::readCommands()
 {
+// don't trigger again, loop runs until all is done
+disconnect(m_stdinNotifier, ::activated, this, 
::readCommands);
+
 while (readCommand())
 {
 // read next command
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-09-18 Thread Libreoffice Gerrit user
 vcl/unx/gtk3/gtk3gtkinst.cxx |   36 +++-
 1 file changed, 31 insertions(+), 5 deletions(-)

New commits:
commit 47ff79610feee88283695fe148b2b03801517e3b
Author: Caolán McNamara 
AuthorDate: Tue Sep 18 09:53:54 2018 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Tue Sep 18 14:52:05 2018 +0200

tdf#119929 ensure .ui translation domain is bound before translation attempt

Change-Id: Ib06b399f6c975c1c64594b0a294b10bc6a9f0a69
Reviewed-on: https://gerrit.libreoffice.org/60667
Reviewed-by: Adolfo Jayme Barrientos 
Tested-by: Adolfo Jayme Barrientos 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 67db66dcdb08..0b855ebd4822 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -4945,6 +4945,7 @@ private:
 GtkBuilder* m_pBuilder;
 GSList* m_pObjectList;
 GtkWidget* m_pParentWidget;
+gulong m_nNotifySignalId;
 std::vector m_aMnemonicButtons;
 std::vector m_aMnemonicLabels;
 
@@ -5030,6 +5031,28 @@ private:
 }
 }
 
+//GtkBuilder sets translation domain during parse, and unsets it again 
afterwards.
+//In order for GtkBuilder to find the translations bindtextdomain has to 
be called
+//for the domain. So here on the first setting of "domain" we call 
Translate::Create
+//to make sure that happens. Without this, if some other part of 
LibreOffice has
+//used the translation machinery for this domain it will still work, but 
if it
+//hasn't, e.g. tdf#119929, then the translation fails
+void translation_domain_set()
+{
+Translate::Create(gtk_builder_get_translation_domain(m_pBuilder), 
LanguageTag(m_aUILang));
+g_signal_handler_disconnect(m_pBuilder, m_nNotifySignalId);
+}
+
+static void signalNotify(GObject*, GParamSpec *pSpec, gpointer pData)
+{
+g_return_if_fail(pSpec != nullptr);
+if (strcmp(pSpec->name, "translation-domain") == 0)
+{
+GtkInstanceBuilder* pBuilder = 
static_cast(pData);
+pBuilder->translation_domain_set();
+}
+}
+
 static void postprocess(gpointer data, gpointer user_data)
 {
 GObject* pObject = static_cast(data);
@@ -5044,14 +5067,10 @@ public:
 , m_pStringReplace(Translate::GetReadStringHook())
 , m_sHelpRoot(rUIFile)
 , m_pParentWidget(pParent)
+, m_nNotifySignalId(0)
 {
 ensure_intercept_drawing_area_accessibility();
 
-OUString aUri(rUIRoot + rUIFile);
-OUString aPath;
-osl::FileBase::getSystemPathFromFileURL(aUri, aPath);
-m_pBuilder = gtk_builder_new_from_file(OUStringToOString(aPath, 
RTL_TEXTENCODING_UTF8).getStr());
-
 sal_Int32 nIdx = m_sHelpRoot.lastIndexOf('.');
 if (nIdx != -1)
 m_sHelpRoot = m_sHelpRoot.copy(0, nIdx);
@@ -5060,6 +5079,13 @@ public:
 m_aIconTheme = 
Application::GetSettings().GetStyleSettings().DetermineIconTheme();
 m_aUILang = Application::GetSettings().GetUILanguageTag().getBcp47();
 
+OUString aUri(rUIRoot + rUIFile);
+OUString aPath;
+osl::FileBase::getSystemPathFromFileURL(aUri, aPath);
+m_pBuilder = gtk_builder_new();
+m_nNotifySignalId = g_signal_connect_data(G_OBJECT(m_pBuilder), 
"notify", G_CALLBACK(signalNotify), this, nullptr, G_CONNECT_AFTER);
+gtk_builder_add_from_file(m_pBuilder, OUStringToOString(aPath, 
RTL_TEXTENCODING_UTF8).getStr(), nullptr);
+
 m_pObjectList = gtk_builder_get_objects(m_pBuilder);
 g_slist_foreach(m_pObjectList, postprocess, this);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-09-18 Thread Libreoffice Gerrit user
 vcl/unx/generic/desktopdetect/desktopdetector.cxx |   21 -
 1 file changed, 16 insertions(+), 5 deletions(-)

New commits:
commit aedccaa4ce5a3f1cc16da29c775c3b8551974b29
Author: Xisco Fauli 
AuthorDate: Mon Sep 17 17:41:41 2018 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Tue Sep 18 14:20:28 2018 +0200

tdf#119881: Check if Unity/Gnome is separated by colon in 
XDG_CURRENT_DESKTOP

Change-Id: Ie29c2213d8efccd7750396325ce05b4909c09d02
Reviewed-on: https://gerrit.libreoffice.org/60592
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 
(cherry picked from commit 79093cce6c3a65f84bbafd172b1e9e6702d3ce75)
Reviewed-on: https://gerrit.libreoffice.org/60677
Reviewed-by: Adolfo Jayme Barrientos 
Tested-by: Adolfo Jayme Barrientos 

diff --git a/vcl/unx/generic/desktopdetect/desktopdetector.cxx 
b/vcl/unx/generic/desktopdetect/desktopdetector.cxx
index 02ac9be09c3d..765aa80dcebb 100644
--- a/vcl/unx/generic/desktopdetect/desktopdetector.cxx
+++ b/vcl/unx/generic/desktopdetect/desktopdetector.cxx
@@ -33,6 +33,7 @@
 
 #include 
 #include 
+#include 
 
 static bool is_gnome_desktop( Display* pDisplay )
 {
@@ -324,14 +325,24 @@ DESKTOP_DETECTOR_PUBLIC DesktopType 
get_desktop_environment()
 aDesktopSession = OString( pSession, strlen( pSession ) );
 
 const char *pDesktop;
-OString aCurrentDesktop;
 if ( ( pDesktop = getenv( "XDG_CURRENT_DESKTOP" ) ) )
-aCurrentDesktop = OString( pDesktop, strlen( pDesktop ) );
+{
+OString aCurrentDesktop = OString( pDesktop, strlen( pDesktop ) );
+
+//it may be separated by colon ( e.g. unity:unity7:ubuntu )
+std::vector aSplitCurrentDesktop = comphelper::string::split(
+OStringToOUString( aCurrentDesktop, RTL_TEXTENCODING_UTF8), 
':');
+for (auto& rCurrentDesktopStr : aSplitCurrentDesktop)
+{
+if ( rCurrentDesktopStr.equalsIgnoreAsciiCase( "unity" ) )
+return DESKTOP_UNITY;
+else if ( rCurrentDesktopStr.equalsIgnoreAsciiCase( "gnome") )
+return DESKTOP_GNOME;
+}
+}
 
 // fast environment variable checks
-if ( aCurrentDesktop.equalsIgnoreAsciiCase( "unity" ) )
-ret = DESKTOP_UNITY;
-else if ( aDesktopSession.equalsIgnoreAsciiCase( "gnome" ) )
+if ( aDesktopSession.equalsIgnoreAsciiCase( "gnome" ) )
 ret = DESKTOP_GNOME;
 else if ( aDesktopSession.equalsIgnoreAsciiCase( "gnome-wayland" ) )
 ret = DESKTOP_GNOME;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-09-06 Thread Libreoffice Gerrit user
 vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 0e98d9a75952116655fa90d83478c2be323fff64
Author: Michael Weghorn 
AuthorDate: Wed Sep 5 18:03:06 2018 +0200
Commit: Katarina Behrens 
CommitDate: Thu Sep 6 11:45:23 2018 +0200

tdf#119685 Fix infinite loop in gtk3_kde5 filepicker

Since 'string::find()' returns the position of the given
character in the string and that was passed as the amount of
characters to delete from the string, 'm_responseBuffer'
would always be a string starting with a newline character
afterwards, when this part of the code was reached.

Subsequent calls to 'Gtk3KDE5FilePickerIpc::readResponseLine'
therefore always returned an empty string and left
'm_responseBuffer' unchanged, resulting in the lambda function
inside 'readResponse' in 'gtk3_kde5_filepicker_ipc.hxx' to
loop infinitely.

While at it, make a little more explicit that 'it' is of type
'size_t' here.

Change-Id: I3b1c209f8307ab71465d9538a82616dff8656415
Reviewed-on: https://gerrit.libreoffice.org/60047
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
(cherry picked from commit 1f5698ba8b62e62999b0efb363916a91bdd54c94)
Reviewed-on: https://gerrit.libreoffice.org/60067
Reviewed-by: Katarina Behrens 

diff --git a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx 
b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx
index 21690c5e74f8..8cec9d853fbc 100644
--- a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx
+++ b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx
@@ -222,11 +222,11 @@ std::string Gtk3KDE5FilePickerIpc::readResponseLine()
 {
 if (!m_responseBuffer.empty()) // check whether we have a line in our 
buffer
 {
-auto it = m_responseBuffer.find('\n');
+std::size_t it = m_responseBuffer.find('\n');
 if (it != std::string::npos)
 {
 auto ret = m_responseBuffer.substr(0, it);
-m_responseBuffer.erase(0, it);
+m_responseBuffer.erase(0, it + 1);
 return ret;
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-08-23 Thread Libreoffice Gerrit user
 vcl/unx/generic/print/glyphset.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 8d49069887443c9eeac9c52441ad1a183d12c384
Author: Jan-Marek Glogowski 
AuthorDate: Thu Aug 23 11:14:37 2018 +0200
Commit: Caolán McNamara 
CommitDate: Thu Aug 23 16:39:36 2018 +0200

tdf#119357 add the glyph, if the lookup failed

Regression from commit de8f6b25de6f ("loplugin:unused-returns in
vcl") changing the logic in hunk:

-returnLookupGlyphID (nGlyph, nOutGlyphID, nOutGlyphSetID)
-   || AddGlyphID(nGlyph, nOutGlyphID, nOutGlyphSetID);
+if (LookupGlyphID(nGlyph, nOutGlyphID, nOutGlyphSetID))
+   AddGlyphID(nGlyph, nOutGlyphID, nOutGlyphSetID);

Change-Id: Id643120e1cf5e26b3ffda933d07893048493f089
Reviewed-on: https://gerrit.libreoffice.org/59493
Tested-by: Xisco Faulí 
Reviewed-by: Noel Grandin 
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 4a58fd0e81b0375c71f6182233f0ec9390942cd1)
Reviewed-on: https://gerrit.libreoffice.org/59502
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/unx/generic/print/glyphset.cxx 
b/vcl/unx/generic/print/glyphset.cxx
index 9dacabb7dfb0..b6e94afc1978 100644
--- a/vcl/unx/generic/print/glyphset.cxx
+++ b/vcl/unx/generic/print/glyphset.cxx
@@ -65,8 +65,8 @@ GlyphSet::GetGlyphID (
   sal_Int32* nOutGlyphSetID
  )
 {
-if (LookupGlyphID(nGlyph, nOutGlyphID, nOutGlyphSetID))
-   AddGlyphID(nGlyph, nOutGlyphID, nOutGlyphSetID);
+if (!LookupGlyphID(nGlyph, nOutGlyphID, nOutGlyphSetID))
+AddGlyphID(nGlyph, nOutGlyphID, nOutGlyphSetID);
 }
 
 bool
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-08-13 Thread Libreoffice Gerrit user
 vcl/unx/gtk3_kde5/kde5_filepicker.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit bb95d1843e5812c9f2bbecdff80f59b83be013db
Author: Katarina Behrens 
AuthorDate: Fri Aug 10 14:36:00 2018 +0200
Commit: Thorsten Behrens 
CommitDate: Tue Aug 14 01:28:03 2018 +0200

tdf#119133: Fix initial file and folder selection

what d7fc00e1f7ab7a44e6102a and 1af4ab72e2488515fcaede already does
for kde5

Change-Id: I924bdc5cfd6a12ff7bdbeef36d606c03307cb99b
Reviewed-on: https://gerrit.libreoffice.org/58832
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 
(cherry picked from commit 87a4623a8dd5c9efed8335bb56145b9ea9dcce36)
Reviewed-on: https://gerrit.libreoffice.org/58905
Reviewed-by: Michael Weghorn 

diff --git a/vcl/unx/gtk3_kde5/kde5_filepicker.cxx 
b/vcl/unx/gtk3_kde5/kde5_filepicker.cxx
index f3b48b837836..e5bdd7e2646c 100644
--- a/vcl/unx/gtk3_kde5/kde5_filepicker.cxx
+++ b/vcl/unx/gtk3_kde5/kde5_filepicker.cxx
@@ -91,9 +91,12 @@ void KDE5FilePicker::setMultiSelectionMode(bool multiSelect)
 _dialog->setFileMode(multiSelect ? QFileDialog::ExistingFiles : 
QFileDialog::ExistingFile);
 }
 
-void KDE5FilePicker::setDefaultName(const QString& name) { 
_dialog->selectUrl(QUrl(name)); }
+void KDE5FilePicker::setDefaultName(const QString& name) { 
_dialog->selectFile(name); }
 
-void KDE5FilePicker::setDisplayDirectory(const QString& dir) { 
_dialog->selectUrl(QUrl(dir)); }
+void KDE5FilePicker::setDisplayDirectory(const QString& dir)
+{
+_dialog->setDirectoryUrl(QUrl(dir));
+}
 
 QString KDE5FilePicker::getDisplayDirectory() const { return 
_dialog->directoryUrl().url(); }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-07-19 Thread Libreoffice Gerrit user
 vcl/unx/gtk3/gtk3gtkframe.cxx |   18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 896b7e69a3182a0142a323ba5f76a2d8a811091a
Author: Caolán McNamara 
AuthorDate: Tue Jul 17 21:29:46 2018 +0100
Commit: Xisco Faulí 
CommitDate: Thu Jul 19 17:56:03 2018 +0200

Resolves: tdf#118302 drag n drop to same tab should cancel dnd

dropComplete is used to do this, follow the mac pattern here to
propogate this in the drag and drop from self to self case.

Maybe this also affects tdf#105320 ?

Change-Id: I2b8f8b0e0486f6ee45a65918fae2537750a75f2d
Reviewed-on: https://gerrit.libreoffice.org/57590
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 6a443526e8db..c1c560b3f9ce 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -3422,6 +3422,9 @@ namespace
 }
 }
 
+static bool g_DropSuccessSet = false;
+static bool g_DropSuccess = false;
+
 class GtkDropTargetDropContext : public 
cppu::WeakImplHelper
 {
 GdkDragContext *m_pContext;
@@ -3447,6 +3450,11 @@ public:
 virtual void SAL_CALL dropComplete(sal_Bool bSuccess) override
 {
 gtk_drag_finish(m_pContext, bSuccess, false, m_nTime);
+if (GtkDragSource::g_ActiveDragSource)
+{
+g_DropSuccessSet = true;
+g_DropSuccess = bSuccess;
+}
 }
 };
 
@@ -4341,9 +4349,12 @@ void GtkDragSource::startDrag(const 
datatransfer::dnd::DragGestureEvent& rEvent,
 // For LibreOffice internal D we provide the Transferable without Gtk
 // intermediaries as a shortcut, see tdf#100097 for how dbaccess 
depends on this
 g_ActiveDragSource = this;
+g_DropSuccessSet = false;
+g_DropSuccess = false;
 
 m_pFrame->startDrag(nDragButton, rEvent.DragOriginX, 
rEvent.DragOriginY,
 VclToGdk(sourceActions), pTargetList);
+
 gtk_target_list_unref(pTargetList);
 for (auto  : aGtkTargets)
 g_free(a.target);
@@ -4428,7 +4439,12 @@ void GtkDragSource::dragEnd(GdkDragContext* context)
 {
 datatransfer::dnd::DragSourceDropEvent aEv;
 aEv.DropAction = 
GdkToVcl(gdk_drag_context_get_selected_action(context));
-aEv.DropSuccess = true;
+// an internal drop can accept the drop but fail with dropComplete( 
false )
+// this is different than the GTK API
+if (g_DropSuccessSet)
+aEv.DropSuccess = g_DropSuccess;
+else
+aEv.DropSuccess = true;
 auto xListener = m_xListener;
 m_xListener.clear();
 xListener->dragDropEnd(aEv);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-07-19 Thread Libreoffice Gerrit user
 vcl/unx/gtk3/gtk3gtkinst.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit a4a523aadea5c966223955517049c1246872aad9
Author: Caolán McNamara 
AuthorDate: Wed Jul 18 16:33:34 2018 +0100
Commit: Christian Lohmaier 
CommitDate: Thu Jul 19 12:19:22 2018 +0200

Resolves: tdf#118802 map GTK_RESPONSE_DELETE_EVENT to RET_CANCEL

Change-Id: I8285f329e4672c90f47d96ccffe60c21c565dde7
Reviewed-on: https://gerrit.libreoffice.org/57656
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 89655fd1b654..10610c089b4d 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2031,6 +2031,8 @@ private:
 ret = RET_OK;
 else if (ret == GTK_RESPONSE_CANCEL)
 ret = RET_CANCEL;
+else if (ret == GTK_RESPONSE_DELETE_EVENT)
+ret = RET_CANCEL;
 else if (ret == GTK_RESPONSE_CLOSE)
 ret = RET_CLOSE;
 else if (ret == GTK_RESPONSE_YES)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-07-18 Thread Libreoffice Gerrit user
 vcl/unx/gtk3/gtk3gtkinst.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 13f451715619aab016bb1d1a02b3c6577178e295
Author: Caolán McNamara 
AuthorDate: Wed Jul 18 09:10:30 2018 +0100
Commit: Eike Rathke 
CommitDate: Wed Jul 18 21:08:26 2018 +0200

only ellipize menubutton label when requesting narrower size

Change-Id: I32f4856756910ec1db8d37854b6e57dbec5aae76
Reviewed-on: https://gerrit.libreoffice.org/57618
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 5c6fc9901d3e..26bc4dbb0e3a 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3054,7 +3054,6 @@ public:
 m_pBox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0));
 
 m_pLabel = GTK_LABEL(gtk_label_new_with_mnemonic(sLabel.getStr()));
-gtk_label_set_ellipsize(m_pLabel, PANGO_ELLIPSIZE_MIDDLE);
 gtk_label_set_mnemonic_widget(m_pLabel, GTK_WIDGET(m_pMenuButton));
 gtk_box_pack_start(m_pBox, GTK_WIDGET(m_pLabel), false, false, 0);
 
@@ -3063,6 +3062,13 @@ public:
 gtk_widget_show_all(GTK_WIDGET(m_pBox));
 }
 
+virtual void set_size_request(int nWidth, int nHeight) override
+{
+// tweak the label to get a narrower size to stick
+gtk_label_set_ellipsize(m_pLabel, PANGO_ELLIPSIZE_MIDDLE);
+gtk_widget_set_size_request(m_pWidget, nWidth, nHeight);
+}
+
 virtual void set_label(const OUString& rText) override
 {
 ::set_label(m_pLabel, rText);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-07-18 Thread Libreoffice Gerrit user
 vcl/unx/gtk3/gtk3gtkinst.cxx |   35 ++-
 1 file changed, 18 insertions(+), 17 deletions(-)

New commits:
commit 8923164778ecfbfd98a398d4525d7b88a06366ea
Author: Caolán McNamara 
AuthorDate: Wed Jul 18 09:01:28 2018 +0100
Commit: Eike Rathke 
CommitDate: Wed Jul 18 21:06:08 2018 +0200

Resolves: tdf#118604 only use popover workaround for popovers, not menus

Change-Id: I7982a3836fbf699979beaa70e34bfa38aea80462
Reviewed-on: https://gerrit.libreoffice.org/57616
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 70b0625dd0e8..5c6fc9901d3e 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3061,23 +3061,6 @@ public:
 gtk_box_pack_end(m_pBox, gtk_image_new_from_icon_name 
("pan-down-symbolic", GTK_ICON_SIZE_BUTTON), false, false, 0);
 gtk_container_add(GTK_CONTAINER(m_pMenuButton), GTK_WIDGET(m_pBox));
 gtk_widget_show_all(GTK_WIDGET(m_pBox));
-
-#if defined(GDK_WINDOWING_X11)
-//under wayland a Popover will work to "escape" the parent dialog, not
-//so under X, so come up with this hack to use a raw GtkWindow
-GdkDisplay *pDisplay = gtk_widget_get_display(m_pWidget);
-if (GDK_IS_X11_DISPLAY(pDisplay))
-{
-m_pMenuHack = GTK_WINDOW(gtk_window_new(GTK_WINDOW_POPUP));
-gtk_window_set_type_hint(m_pMenuHack, GDK_WINDOW_TYPE_HINT_COMBO);
-gtk_window_set_modal(m_pMenuHack, true);
-gtk_window_set_resizable(m_pMenuHack, false);
-m_nSignalId = g_signal_connect(GTK_TOGGLE_BUTTON(pMenuButton), 
"toggled", G_CALLBACK(signalToggled), this);
-g_signal_connect(m_pMenuHack, "grab-broken-event", 
G_CALLBACK(signalGrabBroken), this);
-g_signal_connect(m_pMenuHack, "button-release-event", 
G_CALLBACK(signalButtonRelease), this);
-g_signal_connect(m_pMenuHack, "key-press-event", 
G_CALLBACK(keyPress), this);
-}
-#endif
 }
 
 virtual void set_label(const OUString& rText) override
@@ -3131,6 +3114,24 @@ public:
 {
 GtkInstanceWidget* pPopoverWidget = 
dynamic_cast(pPopover);
 m_pPopover = pPopoverWidget->getWidget();
+
+#if defined(GDK_WINDOWING_X11)
+//under wayland a Popover will work to "escape" the parent dialog, not
+//so under X, so come up with this hack to use a raw GtkWindow
+GdkDisplay *pDisplay = gtk_widget_get_display(m_pWidget);
+if (GDK_IS_X11_DISPLAY(pDisplay))
+{
+m_pMenuHack = GTK_WINDOW(gtk_window_new(GTK_WINDOW_POPUP));
+gtk_window_set_type_hint(m_pMenuHack, GDK_WINDOW_TYPE_HINT_COMBO);
+gtk_window_set_modal(m_pMenuHack, true);
+gtk_window_set_resizable(m_pMenuHack, false);
+m_nSignalId = g_signal_connect(GTK_TOGGLE_BUTTON(m_pMenuButton), 
"toggled", G_CALLBACK(signalToggled), this);
+g_signal_connect(m_pMenuHack, "grab-broken-event", 
G_CALLBACK(signalGrabBroken), this);
+g_signal_connect(m_pMenuHack, "button-release-event", 
G_CALLBACK(signalButtonRelease), this);
+g_signal_connect(m_pMenuHack, "key-press-event", 
G_CALLBACK(keyPress), this);
+}
+#endif
+
 if (m_pMenuHack)
 {
 gtk_menu_button_set_popover(m_pMenuButton, 
gtk_popover_new(GTK_WIDGET(m_pMenuButton)));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-07-18 Thread Libreoffice Gerrit user
 vcl/unx/gtk3/gtk3gtkinst.cxx |   14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 9bde4146ad0ebe6d3298f7d359154459cbf62f89
Author: Caolán McNamara 
AuthorDate: Tue Jul 17 16:05:35 2018 +0100
Commit: Xisco Faulí 
CommitDate: Wed Jul 18 18:01:50 2018 +0200

Resolves: tdf#118801 icons go missing on text-less buttons

Change-Id: I003a59643518e60948d71b335dfcd7e20ba8fee5
Reviewed-on: https://gerrit.libreoffice.org/57573
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index e2bc52fc922a..70b0625dd0e8 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -4975,8 +4975,11 @@ private:
 if (GTK_IS_BUTTON(pWidget))
 {
 GtkButton* pButton = GTK_BUTTON(pWidget);
-if (m_pStringReplace != nullptr) {
-set_label(pButton, (*m_pStringReplace)(get_label(pButton)));
+if (m_pStringReplace != nullptr)
+{
+OUString aLabel(get_label(pButton));
+if (!aLabel.isEmpty())
+set_label(pButton, (*m_pStringReplace)(aLabel));
 }
 if (gtk_button_get_use_underline(pButton) && 
!gtk_button_get_use_stock(pButton))
 m_aMnemonicButtons.push_back(pButton);
@@ -4984,8 +4987,11 @@ private:
 else if (GTK_IS_LABEL(pWidget))
 {
 GtkLabel* pLabel = GTK_LABEL(pWidget);
-if (m_pStringReplace != nullptr) {
-set_label(pLabel, (*m_pStringReplace)(get_label(pLabel)));
+if (m_pStringReplace != nullptr)
+{
+OUString aLabel(get_label(pLabel));
+if (!aLabel.isEmpty())
+set_label(pLabel, (*m_pStringReplace)(aLabel));
 }
 if (gtk_label_get_use_underline(pLabel))
 m_aMnemonicLabels.push_back(pLabel);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-06-20 Thread Caolán McNamara
 vcl/unx/gtk3/gtk3gtkinst.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 202add7f817b6360956b5a41427ee83fa87b7a01
Author: Caolán McNamara 
Date:   Wed Jun 20 15:31:50 2018 +0100

show down arrow in GtkMenuButtons

Change-Id: I6468474110adfc477927f6d89b44e92d29384484
Reviewed-on: https://gerrit.libreoffice.org/56165
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 05035bb756ad..cb5ab02cee52 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -4708,6 +4708,13 @@ private:
 }
 if (gtk_button_get_use_underline(pButton) && 
!gtk_button_get_use_stock(pButton))
 m_aMnemonicButtons.push_back(pButton);
+
+if (GTK_IS_MENU_BUTTON(pWidget))
+{
+gtk_button_set_image(pButton, gtk_image_new_from_icon_name 
("pan-down-symbolic", GTK_ICON_SIZE_BUTTON));
+gtk_button_set_image_position(pButton, GTK_POS_RIGHT);
+gtk_button_set_always_show_image(pButton, true);
+}
 }
 else if (GTK_IS_LABEL(pWidget))
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-06-11 Thread Katarina Behrens
 vcl/unx/gtk3_kde5/filepicker_ipc_commands.hxx |   12 
 1 file changed, 12 insertions(+)

New commits:
commit ee2ce580a186c436662b3864cc5de1d022812a00
Author: Katarina Behrens 
Date:   Fri Jun 8 15:04:13 2018 +0200

Add overloaded read/send funcs for uint64_t (conditionally)

otherwise build fails on 32bit platforms as multiple matching
overloaded func are found. Thanks _rene_ and mst_ for helping
me to figure this out

Change-Id: Ief4571ad735ad4efea9ddc70daea45885e5954c7
Reviewed-on: https://gerrit.libreoffice.org/55474
Reviewed-by: Rene Engelhard 
Tested-by: Rene Engelhard 
Reviewed-by: Katarina Behrens 
Tested-by: Katarina Behrens 
(cherry picked from commit ca4dede186183ca760013ad1885947d68bae02f4)
Reviewed-on: https://gerrit.libreoffice.org/55628

diff --git a/vcl/unx/gtk3_kde5/filepicker_ipc_commands.hxx 
b/vcl/unx/gtk3_kde5/filepicker_ipc_commands.hxx
index 8ce8cfa9e78d..1acef8caf48e 100644
--- a/vcl/unx/gtk3_kde5/filepicker_ipc_commands.hxx
+++ b/vcl/unx/gtk3_kde5/filepicker_ipc_commands.hxx
@@ -100,6 +100,14 @@ inline void readIpcArg(std::istream& stream, sal_uIntPtr& 
value)
 stream.ignore(); // skip space
 }
 
+#if SAL_TYPES_SIZEOFPOINTER == 4
+inline void readIpcArg(std::istream& stream, uint64_t& value)
+{
+stream >> value;
+stream.ignore(); // skip space
+}
+#endif
+
 inline void readIpcArgs(std::istream& /*stream*/)
 {
 // end of arguments, nothing to do
@@ -135,6 +143,10 @@ inline void sendIpcArg(std::ostream& stream, sal_Int16 
value) { stream << value
 
 inline void sendIpcArg(std::ostream& stream, sal_uIntPtr value) { stream << 
value << ' '; }
 
+#if SAL_TYPES_SIZEOFPOINTER == 4
+inline void sendIpcArg(std::ostream& stream, uint64_t value) { stream << value 
<< ' '; }
+#endif
+
 inline void sendIpcArgsImpl(std::ostream& stream)
 {
 // end of arguments, flush stream
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-06-06 Thread Caolán McNamara
 vcl/unx/gtk3/gtk3gtkframe.cxx |   44 --
 1 file changed, 38 insertions(+), 6 deletions(-)

New commits:
commit 8b96445766efe237eb47608ade6c147673466e2e
Author: Caolán McNamara 
Date:   Tue Jun 5 14:57:19 2018 +0100

tdf#117981 translate embedded video window mouse events to parent 
coordinates

Change-Id: I0d8fb6c6adc44389332434f9f6a8396a4d1817cf
Reviewed-on: https://gerrit.libreoffice.org/55337
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit dbd804bac6db541d60b3a101852580b87bd4e33e)
Reviewed-on: https://gerrit.libreoffice.org/55338

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 3595e0bf20c7..38cb6b8c087a 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -2586,11 +2586,28 @@ void GtkSalFrame::closePopup()
 
pSVData->maWinData.mpFirstFloat->EndPopupMode(FloatWinPopupEndFlags::Cancel | 
FloatWinPopupEndFlags::CloseAll);
 }
 
+namespace
+{
+//tdf#117981 translate embedded video window mouse events to parent 
coordinates
+void translate_coords(GdkWindow* pSourceWindow, GtkWidget* pTargetWidget, 
int& rEventX, int& rEventY)
+{
+gpointer user_data=nullptr;
+gdk_window_get_user_data(pSourceWindow, _data);
+GtkWidget* pRealEventWidget = static_cast(user_data);
+if (pRealEventWidget)
+{
+gtk_widget_translate_coordinates(pRealEventWidget, pTargetWidget, 
rEventX, rEventY, , );
+}
+}
+}
+
 gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, 
gpointer frame )
 {
 UpdateLastInputEventTime(pEvent->time);
 
 GtkSalFrame* pThis = static_cast(frame);
+GtkWidget* pEventWidget = pThis->getMouseEventWidget();
+bool bDifferentEventWindow = pEvent->window != 
widget_get_window(pEventWidget);
 
 SalMouseEvent aEvent;
 SalEvent nEventType = SalEvent::NONE;
@@ -2619,7 +2636,7 @@ gboolean GtkSalFrame::signalButton( GtkWidget*, 
GdkEventButton* pEvent, gpointer
 {
 //rhbz#1505379 if the window that got the event isn't our one, or 
there's none
 //of our windows under the mouse then close this popup window
-if (pEvent->window != widget_get_window(pThis->getMouseEventWidget()) 
||
+if (bDifferentEventWindow ||
 gdk_device_get_window_at_position(pEvent->device, nullptr, 
nullptr) == nullptr)
 {
 if (pEvent->type == GDK_BUTTON_PRESS)
@@ -2629,10 +2646,16 @@ gboolean GtkSalFrame::signalButton( GtkWidget*, 
GdkEventButton* pEvent, gpointer
 }
 }
 
+int nEventX = pEvent->x;
+int nEventY = pEvent->y;
+
+if (bDifferentEventWindow)
+translate_coords(pEvent->window, pEventWidget, nEventX, nEventY);
+
 if (!aDel.isDeleted())
 {
-int frame_x = static_cast(pEvent->x_root - pEvent->x);
-int frame_y = static_cast(pEvent->y_root - pEvent->y);
+int frame_x = static_cast(pEvent->x_root - nEventX);
+int frame_y = static_cast(pEvent->y_root - nEventY);
 if (pThis->m_bGeometryIsProvisional || frame_x != pThis->maGeometry.nX 
|| frame_y != pThis->maGeometry.nY)
 {
 pThis->m_bGeometryIsProvisional = false;
@@ -2843,18 +2866,27 @@ gboolean GtkSalFrame::signalMotion( GtkWidget*, 
GdkEventMotion* pEvent, gpointer
 UpdateLastInputEventTime(pEvent->time);
 
 GtkSalFrame* pThis = static_cast(frame);
+GtkWidget* pEventWidget = pThis->getMouseEventWidget();
+bool bDifferentEventWindow = pEvent->window != 
widget_get_window(pEventWidget);
 
 //If a menu, e.g. font name dropdown, is open, then under wayland moving 
the
 //mouse in the top left corner of the toplevel window in a
 //0,0,float-width,float-height area generates motion events which are
 //delivered to the dropdown
-if (pThis->isFloatGrabWindow() && pEvent->window != 
widget_get_window(pThis->getMouseEventWidget()))
+if (pThis->isFloatGrabWindow() && bDifferentEventWindow)
 return true;
 
 vcl::DeletionListener aDel( pThis );
 
-int frame_x = static_cast(pEvent->x_root - pEvent->x);
-int frame_y = static_cast(pEvent->y_root - pEvent->y);
+int nEventX = pEvent->x;
+int nEventY = pEvent->y;
+
+if (bDifferentEventWindow)
+translate_coords(pEvent->window, pEventWidget, nEventX, nEventY);
+
+int frame_x = static_cast(pEvent->x_root - nEventX);
+int frame_y = static_cast(pEvent->y_root - nEventY);
+
 if (pThis->m_bGeometryIsProvisional || frame_x != pThis->maGeometry.nX || 
frame_y != pThis->maGeometry.nY)
 {
 pThis->m_bGeometryIsProvisional = false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-06-05 Thread Caolán McNamara
 vcl/unx/gtk3/gtk3gtkinst.cxx |   15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

New commits:
commit fb63ec23b4ae3cff771934714f0bad003123cdd0
Author: Caolán McNamara 
Date:   Tue Jun 5 12:35:33 2018 +0100

tdf#117991 let focus change get processed before selection change

Change-Id: I78999730bc942733d7498415d920d94f2422ac6f
Reviewed-on: https://gerrit.libreoffice.org/55330
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 78d81061bb34..cc927fe89742 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3080,11 +3080,18 @@ private:
 gulong m_nChangedSignalId;
 gulong m_nRowActivatedSignalId;
 
+DECL_LINK(async_signal_changed, void*, void);
+
 static void signalChanged(GtkTreeView*, gpointer widget)
 {
 GtkInstanceTreeView* pThis = static_cast(widget);
-SolarMutexGuard aGuard;
-pThis->signal_changed();
+//tdf#117991 selection change is sent before the focus change, and 
focus change
+//is what will cause a spinbutton that currently has the focus to set 
its contents
+//as the spin button value. So any LibreOffice callbacks on
+//signal-change would happen before the spinbutton value-change occurs.
+//To avoid this, send the signal-change to LibreOffice to occur after 
focus-change
+//has been processed
+Application::PostUserEvent(LINK(pThis, GtkInstanceTreeView, 
async_signal_changed));
 }
 
 static void signalRowActivated(GtkTreeView*, GtkTreePath*, 
GtkTreeViewColumn*, gpointer widget)
@@ -3390,6 +3397,10 @@ public:
 }
 };
 
+IMPL_LINK_NOARG(GtkInstanceTreeView, async_signal_changed, void*, void)
+{
+signal_changed();
+}
 
 class GtkInstanceSpinButton : public GtkInstanceEntry, public virtual 
weld::SpinButton
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-06-03 Thread Caolán McNamara
 vcl/unx/generic/window/salobj.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 593a736378ffe88cdad128073c134db616cb24eb
Author: Caolán McNamara 
Date:   Sat Jun 2 19:45:19 2018 +0100

coverity#708674 Uninitialized scalar field

Change-Id: Icbd707fc5bcdad58592ab80c095ad0b1d655786c
Reviewed-on: https://gerrit.libreoffice.org/55215
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/unx/generic/window/salobj.cxx 
b/vcl/unx/generic/window/salobj.cxx
index 76fe2311514c..6cc70916a691 100644
--- a/vcl/unx/generic/window/salobj.cxx
+++ b/vcl/unx/generic/window/salobj.cxx
@@ -213,6 +213,7 @@ SalClipRegion::UnionClipRegion( long nX, long nY, long 
nWidth, long nHeight )
 // SalObject Implementation
 X11SalObject::X11SalObject()
 : mpParent(nullptr)
+, maParentWin(0)
 , maPrimary(0)
 , maSecondary(0)
 , maColormap(0)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-06-02 Thread Caolán McNamara
 vcl/unx/generic/gdi/salgdi.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 833a76113d588b0e7ce375ccdeca0bde516a2647
Author: Caolán McNamara 
Date:   Fri Jun 1 13:02:04 2018 +0100

Resolves: tdf#101798 ResetClipRegion needs to affect cairo drawing too

regression since...

commit cb382034b061b4acd4f0fd490f42af34517a7b8d
Date:   Fri Jul 1 14:00:00 2016 +0200

tdf#50613 speedup fat line drawing on linux using cairo

Change-Id: I2f1a70f102786228d52199df9960336218c6f9f9
Reviewed-on: https://gerrit.libreoffice.org/55181
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index 80dc7ecad17c..bc31846f0159 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -349,6 +349,9 @@ long X11SalGraphics::GetGraphicsWidth() const
 
 void X11SalGraphics::ResetClipRegion()
 {
+#if ENABLE_CAIRO_CANVAS
+maClipRegion.SetNull();
+#endif
 mxImpl->ResetClipRegion();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-05-31 Thread Caolán McNamara
 vcl/unx/gtk3/gtk3gtkinst.cxx |   17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

New commits:
commit f5f182e6d0894576d9e16d3de26eaacb2236a171
Author: Caolán McNamara 
Date:   Wed May 30 21:28:22 2018 +0100

RTL support for custom widgets

Change-Id: I34038f047c002a1ec1276f8c523db0e1c4d29065
Reviewed-on: https://gerrit.libreoffice.org/55102
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 5d801c5c..d13cb73df419 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1689,6 +1689,8 @@ public:
 {
 GdkRectangle aRect{static_cast(rRect.Left()), 
static_cast(rRect.Top()),
static_cast(rRect.GetWidth()), 
static_cast(rRect.GetHeight())};
+if (AllSettings::GetLayoutRTL())
+aRect.x = gtk_widget_get_allocated_width(pWidget) - 
aRect.width - 1 - aRect.x;
 gtk_menu_popup_at_rect(m_pMenu, gtk_widget_get_window(pWidget), 
, GDK_GRAVITY_NORTH_WEST, GDK_GRAVITY_NORTH_WEST, nullptr);
 }
 else
@@ -3741,7 +3743,7 @@ private:
 {
 m_aStyleUpdatedHdl.Call(*this);
 }
-static gboolean signalQueryTooltip(GtkWidget*, gint x, gint y,
+static gboolean signalQueryTooltip(GtkWidget* pGtkWidget, gint x, gint y,
  gboolean /*keyboard_mode*/, 
GtkTooltip *tooltip,
  gpointer widget)
 {
@@ -3756,6 +3758,8 @@ private:
 aGdkHelpArea.y = aHelpArea.Top();
 aGdkHelpArea.width = aHelpArea.GetWidth();
 aGdkHelpArea.height = aHelpArea.GetHeight();
+if (AllSettings::GetLayoutRTL())
+aGdkHelpArea.x = gtk_widget_get_allocated_width(pGtkWidget) - 
aGdkHelpArea.width - 1 - aGdkHelpArea.x;
 gtk_tooltip_set_tip_area(tooltip, );
 return true;
 }
@@ -3816,6 +3820,8 @@ private:
 }
 
 Point aPos(pEvent->x, pEvent->y);
+if (AllSettings::GetLayoutRTL())
+aPos.setX(gtk_widget_get_allocated_width(m_pWidget) - 1 - 
aPos.X());
 sal_uInt32 nModCode = GtkSalFrame::GetMouseModCode(pEvent->state);
 sal_uInt16 nCode = m_nLastMouseButton | (nModCode & (KEY_SHIFT | 
KEY_MOD1 | KEY_MOD2));
 MouseEvent aMEvt(aPos, nClicks, 
ImplGetMouseButtonMode(m_nLastMouseButton, nModCode), nCode, nCode);
@@ -3836,6 +3842,8 @@ private:
 bool signal_motion(GdkEventMotion* pEvent)
 {
 Point aPos(pEvent->x, pEvent->y);
+if (AllSettings::GetLayoutRTL())
+aPos.setX(gtk_widget_get_allocated_width(m_pWidget) - 1 - 
aPos.X());
 sal_uInt32 nModCode = GtkSalFrame::GetMouseModCode(pEvent->state);
 sal_uInt16 nCode = m_nLastMouseButton | (nModCode & (KEY_SHIFT | 
KEY_MOD1 | KEY_MOD2));
 MouseEvent aMEvt(aPos, 0, ImplGetMouseMoveMode(nModCode), nCode, 
nCode);
@@ -3890,6 +3898,7 @@ public:
 {
 gtk_widget_set_has_tooltip(m_pWidget, true);
 g_object_set_data(G_OBJECT(m_pDrawingArea), 
"g-lo-GtkInstanceDrawingArea", this);
+m_xDevice->EnableRTL(get_direction());
 }
 
 AtkObject* GetAtkObject(AtkObject* pDefaultAccessible)
@@ -3903,6 +3912,12 @@ public:
 return m_pAccessible;
 }
 
+virtual void set_direction(bool bRTL) override
+{
+GtkInstanceWidget::set_direction(bRTL);
+m_xDevice->EnableRTL(bRTL);
+}
+
 virtual void queue_draw() override
 {
 gtk_widget_queue_draw(GTK_WIDGET(m_pDrawingArea));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-05-31 Thread Caolán McNamara
 vcl/unx/gtk/a11y/atkwrapper.hxx |8 
 vcl/unx/gtk3/gtk3gtkinst.cxx|   25 +++--
 2 files changed, 31 insertions(+), 2 deletions(-)

New commits:
commit e547b1a36061f3ece12baa348bdd3814aa745ae4
Author: Caolán McNamara 
Date:   Wed May 30 16:26:40 2018 +0100

tdf#117859 crash in Tab Color a11y

Change-Id: I935f0b1a28b483fad70caf7af96742dee74916ad
Reviewed-on: https://gerrit.libreoffice.org/55089
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/unx/gtk/a11y/atkwrapper.hxx b/vcl/unx/gtk/a11y/atkwrapper.hxx
index c45f0f9c839b..381f3c074fdf 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.hxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.hxx
@@ -21,6 +21,10 @@
 #define INCLUDED_VCL_UNX_GTK_A11Y_ATKWRAPPER_HXX
 
 #include 
+#include 
+#if GTK_CHECK_VERSION(3,0,0)
+#include 
+#endif
 #include 
 
 extern "C" {
@@ -70,7 +74,11 @@ struct AtkObjectWrapper
 
 struct AtkObjectWrapperClass
 {
+#if GTK_CHECK_VERSION(3,0,0)
+GtkWidgetAccessibleClass aParentClass;
+#else
 AtkObjectClass aParentClass;
+#endif
 };
 
 GType  atk_object_wrapper_get_type() G_GNUC_CONST;
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 577d5e1d2744..5d801c5c 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3653,6 +3653,14 @@ static MouseEventModifiers 
ImplGetMouseMoveMode(sal_uInt16 nCode)
 return nMode;
 }
 
+namespace
+{
+
+AtkObject* (*default_drawing_area_get_accessible)(GtkWidget *widget);
+
+}
+
+
 class GtkInstanceDrawingArea : public GtkInstanceWidget, public virtual 
weld::DrawingArea
 {
 private:
@@ -3928,6 +3936,21 @@ public:
 return uno::Reference();
 }
 
+virtual void set_accessible_name(const OUString& rName) override
+{
+AtkObject* pAtkObject = default_drawing_area_get_accessible(m_pWidget);
+if (!pAtkObject)
+return;
+atk_object_set_name(pAtkObject, OUStringToOString(rName, 
RTL_TEXTENCODING_UTF8).getStr());
+}
+
+virtual OUString get_accessible_name() const override
+{
+AtkObject* pAtkObject = default_drawing_area_get_accessible(m_pWidget);
+const char* pStr = pAtkObject ? atk_object_get_name(pAtkObject) : 
nullptr;
+return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8);
+}
+
 virtual ~GtkInstanceDrawingArea() override
 {
 g_object_steal_data(G_OBJECT(m_pDrawingArea), 
"g-lo-GtkInstanceDrawingArea");
@@ -4411,8 +4434,6 @@ namespace
 namespace
 {
 
-AtkObject* (*default_drawing_area_get_accessible)(GtkWidget *widget);
-
 AtkObject* drawing_area_get_accessibity(GtkWidget *pWidget)
 {
 AtkObject* pDefaultAccessible = 
default_drawing_area_get_accessible(pWidget);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-05-29 Thread Caolán McNamara
 vcl/unx/gtk3/gtk3gtkinst.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 5dc1b50e952765b160395aef15730c71864786ff
Author: Caolán McNamara 
Date:   Tue May 29 12:41:07 2018 +0100

disable inconsistent when setting true/false

Change-Id: Ib612e7f38c7a1a638d69af2a6d26f1293fe0c8da
Reviewed-on: https://gerrit.libreoffice.org/55017
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index e956f4a3c93b..577d5e1d2744 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2692,6 +2692,7 @@ public:
 virtual void set_active(bool active) override
 {
 disable_notify_events();
+gtk_toggle_button_set_inconsistent(m_pToggleButton, false);
 gtk_toggle_button_set_active(m_pToggleButton, active);
 enable_notify_events();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-05-29 Thread Caolán McNamara
 vcl/unx/gtk3/gtk3gtkinst.cxx |   14 ++
 1 file changed, 14 insertions(+)

New commits:
commit 9773f6140e9c990f6f7e4ea366580cb94bd1539c
Author: Caolán McNamara 
Date:   Tue May 29 11:26:07 2018 +0100

only get notified for user events, not api ones

Change-Id: I4cbede587ed4de7950fd7ca435902baa26c8faf5
Reviewed-on: https://gerrit.libreoffice.org/55014
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 28ef5090b1fd..e956f4a3c93b 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2514,9 +2514,23 @@ public:
 return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8);
 }
 
+virtual void disable_notify_events() override
+{
+g_signal_handler_block(m_pNotebook, m_nSignalId);
+GtkInstanceContainer::disable_notify_events();
+}
+
+virtual void enable_notify_events() override
+{
+GtkInstanceContainer::enable_notify_events();
+g_signal_handler_unblock(m_pNotebook, m_nSignalId);
+}
+
 virtual void remove_page(const OString& rIdent) override
 {
+disable_notify_events();
 gtk_notebook_remove_page(m_pNotebook, get_page_number(rIdent));
+enable_notify_events();
 }
 
 virtual ~GtkInstanceNotebook() override
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/unx

2018-05-29 Thread Caolán McNamara
 vcl/unx/gtk3/gtk3gtkinst.cxx |   15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

New commits:
commit cb65109caf5ba5b2c04202464a435c658a4a1ccc
Author: Caolán McNamara 
Date:   Tue May 29 14:23:03 2018 +0100

remember button pressed to reuse for move

Change-Id: I4a7f5bb8e46e190f33150f666a653bfc04957a0f
Reviewed-on: https://gerrit.libreoffice.org/55016
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 9a1d58098e74..28ef5090b1fd 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3647,6 +3647,7 @@ private:
 ScopedVclPtrInstance m_xDevice;
 std::vector m_aBuffer;
 cairo_surface_t* m_pSurface;
+sal_uInt16 m_nLastMouseButton;
 gulong m_nDrawSignalId;
 gulong m_nSizeAllocateSignalId;
 gulong m_nButtonPressSignalId;
@@ -3776,17 +3777,16 @@ private:
 return false;
 }
 
-sal_uInt16 nButton;
 switch (pEvent->button)
 {
 case 1:
-nButton = MOUSE_LEFT;
+m_nLastMouseButton = MOUSE_LEFT;
 break;
 case 2:
-nButton = MOUSE_MIDDLE;
+m_nLastMouseButton = MOUSE_MIDDLE;
 break;
 case 3:
-nButton = MOUSE_RIGHT;
+m_nLastMouseButton = MOUSE_RIGHT;
 break;
 default:
 return false;
@@ -3794,8 +3794,8 @@ private:
 
 Point aPos(pEvent->x, pEvent->y);
 sal_uInt32 nModCode = GtkSalFrame::GetMouseModCode(pEvent->state);
-sal_uInt16 nCode = nButton | (nModCode & (KEY_SHIFT | KEY_MOD1 | 
KEY_MOD2));
-MouseEvent aMEvt(aPos, nClicks, ImplGetMouseButtonMode(nButton, 
nModCode), nCode, nCode);
+sal_uInt16 nCode = m_nLastMouseButton | (nModCode & (KEY_SHIFT | 
KEY_MOD1 | KEY_MOD2));
+MouseEvent aMEvt(aPos, nClicks, 
ImplGetMouseButtonMode(m_nLastMouseButton, nModCode), nCode, nCode);
 
 if (nEventType == SalEvent::MouseButtonDown)
 m_aMousePressHdl.Call(aMEvt);
@@ -3814,7 +3814,7 @@ private:
 {
 Point aPos(pEvent->x, pEvent->y);
 sal_uInt32 nModCode = GtkSalFrame::GetMouseModCode(pEvent->state);
-sal_uInt16 nCode = (nModCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2));
+sal_uInt16 nCode = m_nLastMouseButton | (nModCode & (KEY_SHIFT | 
KEY_MOD1 | KEY_MOD2));
 MouseEvent aMEvt(aPos, 0, ImplGetMouseMoveMode(nModCode), nCode, 
nCode);
 
 m_aMouseMotionHdl.Call(aMEvt);
@@ -3854,6 +3854,7 @@ public:
 , m_pAccessible(nullptr)
 , m_xDevice(nullptr, Size(1, 1), DeviceFormat::DEFAULT)
 , m_pSurface(nullptr)
+, m_nLastMouseButton(0)
 , m_nDrawSignalId(g_signal_connect(m_pDrawingArea, "draw", 
G_CALLBACK(signalDraw), this))
 , m_nSizeAllocateSignalId(g_signal_connect(m_pDrawingArea, 
"size_allocate", G_CALLBACK(signalSizeAllocate), this))
 , m_nButtonPressSignalId(g_signal_connect(m_pDrawingArea, 
"button-press-event", G_CALLBACK(signalButton), this))
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits