[Libreoffice-commits] core.git: vcl/inc vcl/Library_vcl.mk vcl/osx vcl/source

2018-09-18 Thread Libreoffice Gerrit user
 vcl/Library_vcl.mk|1 
 vcl/inc/osx/salinst.h |3 
 vcl/osx/saldata.cxx   |8 +
 vcl/osx/salinst.cxx   |  107 +--
 vcl/osx/salmenu.cxx   |  190 +++---
 vcl/osx/vclnsapp.mm   |   16 ---
 vcl/source/app/svmain.cxx |   10 --
 vcl/source/app/svmainhook.cxx |   34 ---
 8 files changed, 127 insertions(+), 242 deletions(-)

New commits:
commit 925e2edb6f3f8fffcff9eddb31ed18bc77e2a690
Author: Jan-Marek Glogowski 
AuthorDate: Thu Sep 13 12:44:24 2018 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Tue Sep 18 11:43:30 2018 +0200

Drop NSApplicationMain usage

Allows to drop all the special SVMain handling introduced for
MacOSX. This way LO can also be build via SSH, because gengal
won't abort / fail because of the missing window system.

Currently this just implements the global menu. I don't know
what else is missing. Eventually we want to reimplement the
Cocoa debug option forwarding (NSAccessibilityDebugLogLevel).

Change-Id: I359c46fd03e2436a8a37fd211e59e4e305f8aba0
Reviewed-on: https://gerrit.libreoffice.org/60571
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 2f69f6550dae..f9df0a3a5f36 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -373,7 +373,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
 vcl/source/app/svapp \
 vcl/source/app/svdata \
 vcl/source/app/svmain \
-vcl/source/app/svmainhook \
 vcl/source/app/timer \
 vcl/source/app/unohelp2 \
 vcl/source/app/unohelp \
diff --git a/vcl/inc/osx/salinst.h b/vcl/inc/osx/salinst.h
index 60a542afcf9d..afb1d2b34aa3 100644
--- a/vcl/inc/osx/salinst.h
+++ b/vcl/inc/osx/salinst.h
@@ -90,6 +90,8 @@ public:
 AquaSalInstance();
 virtual ~AquaSalInstance() override;
 
+virtual void AfterAppInit() override;
+
 virtual SalFrame*   CreateChildFrame( SystemParentData* pParent, 
SalFrameStyleFlags nStyle ) override;
 virtual SalFrame*   CreateFrame( SalFrame* pParent, SalFrameStyleFlags 
nStyle ) override;
 virtual voidDestroyFrame( SalFrame* pFrame ) override;
@@ -144,7 +146,6 @@ public:
 void endedPrintJob() { mnActivePrintJobs--; }
 
 // event subtypes for NSApplicationDefined events
-static const short AppExecuteSVMain   = 0x7fff;
 static const short AppEndLoopEvent= 1;
 static const short AppStartTimerEvent = 10;
 static const short YieldWakeupEvent   = 20;
diff --git a/vcl/osx/saldata.cxx b/vcl/osx/saldata.cxx
index 3357adbcd60a..033114dae7e1 100644
--- a/vcl/osx/saldata.cxx
+++ b/vcl/osx/saldata.cxx
@@ -54,6 +54,7 @@ SalData::SalData()
 mnDPIX( 0 ),
 mnDPIY( 0 )
 {
+SetSalData(this);
 maCursors.fill( INVALID_CURSOR_PTR );
 if( s_aAutoReleaseKey == nullptr )
 s_aAutoReleaseKey = osl_createThreadKey( releasePool );
@@ -85,6 +86,13 @@ SalData::~SalData()
 if ( mpAppleRemoteMainController )
 [mpAppleRemoteMainController release];
 #endif
+
+if( mpStatusItem )
+{
+[mpStatusItem release];
+mpStatusItem = nil;
+}
+SetSalData( nullptr );
 }
 
 void SalData::ensureThreadAutoreleasePool()
diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index 0314b85ef1f8..e81278b807fb 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -77,9 +77,7 @@ extern "C" {
 using namespace std;
 using namespace ::com::sun::star;
 
-static int* gpnInit = nullptr;
 static NSMenu* pDockMenu = nil;
-static bool bNoSVMain = true;
 static bool bLeftMain = false;
 
 class AquaDelayedSettingsChanged : public Idle
@@ -143,23 +141,7 @@ bool AquaSalInstance::isOnCommandLine( const OUString& 
rArg )
 return false;
 }
 
-// initialize the cocoa VCL_NSApplication object
-// returns an NSAutoreleasePool that must be released when the event loop 
begins
-static void initNSApp()
-{
-// create our cocoa NSApplication
-[VCL_NSApplication sharedApplication];
-
-SalData::ensureThreadAutoreleasePool();
-
-// put cocoa into multithreaded mode
-[NSThread detachNewThreadSelector:@selector(enableCocoaThreads:) 
toTarget:[[CocoaThreadEnabler alloc] init] withObject:nil];
-
-// activate our delegate methods
-[NSApp setDelegate: NSApp];
-}
-
-void postInitVCLinitNSApp()
+void AquaSalInstance::AfterAppInit()
 {
 [[NSNotificationCenter defaultCenter] addObserver: NSApp
   selector: 
@selector(systemColorsChanged:)
@@ -196,38 +178,6 @@ void postInitVCLinitNSApp()
 #endif
 }
 
-bool ImplSVMainHook( int * pnInit )
-{
-if (comphelper::LibreOfficeKit::isActive())
-return false;
-
-NSAutoreleasePool * pool = [ [ NSAutoreleasePool alloc ] init ];
-unlink([[NSString stringWithFormat:@"%@/Library/Saved Application 
State/%s.savedState/restorecount.plist", NSHomeDirectory(), 

[Libreoffice-commits] core.git: vcl/inc vcl/Library_vcl.mk vcl/osx vcl/source

2015-12-08 Thread Tor Lillqvist
 vcl/Library_vcl.mk  |4 
 vcl/inc/OpenGLWrapper.hxx   |   20 
 vcl/osx/OpenGLWrapper.cxx   |   27 ---
 vcl/source/opengl/OpenGLContext.cxx |   13 +++--
 4 files changed, 7 insertions(+), 57 deletions(-)

New commits:
commit dff18c2be9c72aa05940982f506804eb41d3d79a
Author: Tor Lillqvist 
Date:   Tue Dec 8 13:58:27 2015 +0200

Bin the pointless and thin OS X specific wrapper namespace 'OpenGLWrapper'

Besides, the namespace was confusingly named the same as the public
cross-platform OpenGLWrapper struct (which is effectively just a
namespace, too).

Change-Id: I9a5255ec446dcdb5086d92a742f29327d0780685

diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 87570d6..c7eee7f 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -106,10 +106,6 @@ $(eval $(call gb_Library_add_cxxflags,vcl,\
 $(gb_OBJCXXFLAGS) \
 ))
 
-$(eval $(call gb_Library_add_exception_objects,vcl,\
-vcl/osx/OpenGLWrapper \
-))
-
 endif
 
 ifeq ($(ENABLE_JAVA),TRUE)
diff --git a/vcl/inc/OpenGLWrapper.hxx b/vcl/inc/OpenGLWrapper.hxx
deleted file mode 100644
index 9134801..000
--- a/vcl/inc/OpenGLWrapper.hxx
+++ /dev/null
@@ -1,20 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include "AppKit/NSOpenGLView.h"
-#include "AppKit/NSOpenGL.h"
-
-namespace OpenGLWrapper
-{
-void swapBuffers(NSOpenGLView* pView);
-void makeCurrent(NSOpenGLView* pView);
-void resetCurrent();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/osx/OpenGLWrapper.cxx b/vcl/osx/OpenGLWrapper.cxx
deleted file mode 100644
index fc008f4..000
--- a/vcl/osx/OpenGLWrapper.cxx
+++ /dev/null
@@ -1,27 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include "OpenGLWrapper.hxx"
-
-void OpenGLWrapper::swapBuffers(NSOpenGLView* pView)
-{
-[[pView openGLContext] flushBuffer];
-}
-
-void OpenGLWrapper::makeCurrent(NSOpenGLView* pView)
-{
-[[pView openGLContext] makeCurrentContext];
-}
-
-void OpenGLWrapper::resetCurrent()
-{
-[NSOpenGLContext clearCurrentContext];
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/opengl/OpenGLContext.cxx 
b/vcl/source/opengl/OpenGLContext.cxx
index 4a68ab8..8c5db0f 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -20,7 +20,8 @@
 
 #if defined(MACOSX)
 #include 
-#include "OpenGLWrapper.hxx"
+#include 
+#include 
 #include 
 #endif
 
@@ -986,7 +987,7 @@ bool OpenGLContext::ImplInit()
 
 VCL_GL_INFO("OpenGLContext::ImplInitstart");
 NSOpenGLView* pView = getOpenGLView();
-OpenGLWrapper::makeCurrent(pView);
+[[pView openGLContext] makeCurrentContext];
 
 bool bRet = InitGLEW();
 InitGLEWDebugging();
@@ -1252,7 +1253,7 @@ void OpenGLContext::reset()
 m_aGLWin.hRC = 0;
 }
 #elif defined( MACOSX )
-OpenGLWrapper::resetCurrent();
+[NSOpenGLContext clearCurrentContext];
 #elif defined( IOS ) || defined( ANDROID ) || defined(LIBO_HEADLESS)
 // nothing
 #elif defined( UNX )
@@ -1408,7 +1409,7 @@ void OpenGLContext::makeCurrent()
 }
 #elif defined( MACOSX )
 NSOpenGLView* pView = getOpenGLView();
-OpenGLWrapper::makeCurrent(pView);
+[[pView openGLContext] makeCurrentContext];
 #elif defined( IOS ) || defined( ANDROID ) || defined(LIBO_HEADLESS)
 // nothing
 #elif defined( UNX )
@@ -1462,7 +1463,7 @@ void OpenGLContext::resetCurrent()
 wglMakeCurrent(NULL, NULL);
 #elif defined( MACOSX )
 (void) this; // loplugin:staticmethods
-OpenGLWrapper::resetCurrent();
+[NSOpenGLContext clearCurrentContext];
 #elif defined( IOS ) || defined( ANDROID ) || defined(LIBO_HEADLESS)
 // nothing
 #elif defined( UNX )
@@ -1479,7 +1480,7 @@ void OpenGLContext::swapBuffers()
 SwapBuffers(m_aGLWin.hDC);
 #elif defined( MACOSX )
 NSOpenGLView* pView = getOpenGLView();
-OpenGLWrapper::swapBuffers(pView);
+[[pView openGLContext] flushBuffer];
 #elif defined( IOS ) || defined( ANDROID ) || defined(LIBO_HEADLESS)
 // nothing
 #elif defined( UNX )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits