[PATCH] fdo#58807 bring Beep() for basic back
Thomas Arnhold (via Code Review)
gerrit at gerrit.libreoffice.org
Sat Mar 30 08:59:08 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3124
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/24/3124/1
fdo#58807 bring Beep() for basic back
The functionality was removed by fdo#48549.
This partially reverts
0f6101cfef4c2e45d9f1f1b3a61ef94799e4526b
0bdf6fc7c71c4c49e6d6f83d56ac953272ad16d5
85cb9084533605657aca0394afe4516058a8e4ef
I changed the behavior to always beep, because only the basic macro
function is using Beep(). Looks like the Beep macro function didn't
even work correctly before the removal, because the default was to
not beep for most platforms. So I set the volume from disable (0)
to 50% for XBell().
Change-Id: I663ffb7af75d2fd6d2c1f94073e4412d9744de4a
---
M basic/source/runtime/methods.cxx
M vcl/Library_vcl.mk
M vcl/Package_inc.mk
M vcl/aqua/source/window/salframe.cxx
M vcl/headless/svpframe.cxx
M vcl/inc/aqua/salframe.h
M vcl/inc/headless/svpframe.hxx
M vcl/inc/salframe.hxx
M vcl/inc/unx/gtk/gtkframe.hxx
M vcl/inc/unx/saldisp.hxx
M vcl/inc/unx/salframe.h
M vcl/inc/win/salframe.h
M vcl/unx/generic/app/saldisp.cxx
M vcl/unx/generic/window/salframe.cxx
M vcl/unx/gtk/window/gtkframe.cxx
M vcl/win/source/window/salframe.cxx
16 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 211618a..f368ee2 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -22,6 +22,7 @@
#include <osl/process.h>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
+#include <vcl/sound.hxx>
#include <tools/wintypes.hxx>
#include <vcl/msgbox.hxx>
#include <basic/sbx.hxx>
@@ -4226,6 +4227,7 @@
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
+ Sound::Beep();
}
RTLFUNC(Load)
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 64456e1..c72f6a9 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -121,6 +121,7 @@
vcl/source/app/session \
vcl/source/app/settings \
vcl/source/app/solarmutex \
+ vcl/source/app/sound \
vcl/source/app/stdtext \
vcl/source/app/svapp \
vcl/source/app/svdata \
diff --git a/vcl/Package_inc.mk b/vcl/Package_inc.mk
index 1ddefa6..08be3a2 100644
--- a/vcl/Package_inc.mk
+++ b/vcl/Package_inc.mk
@@ -126,6 +126,7 @@
$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/settings.hxx,vcl/settings.hxx))
$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/slider.hxx,vcl/slider.hxx))
$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/solarmutex.hxx,vcl/solarmutex.hxx))
+$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/sound.hxx,vcl/sound.hxx))
$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/spinfld.hxx,vcl/spinfld.hxx))
$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/spin.h,vcl/spin.h))
$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/spin.hxx,vcl/spin.hxx))
diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx
index 854b88c..1d03c30 100644
--- a/vcl/aqua/source/window/salframe.cxx
+++ b/vcl/aqua/source/window/salframe.cxx
@@ -1343,6 +1343,13 @@
// -----------------------------------------------------------------------
+void AquaSalFrame::Beep()
+{
+ NSBeep();
+}
+
+// -----------------------------------------------------------------------
+
void AquaSalFrame::SetPosSize(long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags)
{
if ( !mpWindow )
diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx
index bf679d9..41f4629 100644
--- a/vcl/headless/svpframe.cxx
+++ b/vcl/headless/svpframe.cxx
@@ -419,6 +419,10 @@
{
}
+void SvpSalFrame::Beep()
+{
+}
+
const SystemEnvData* SvpSalFrame::GetSystemData() const
{
return &m_aSystemChildData;
diff --git a/vcl/inc/aqua/salframe.h b/vcl/inc/aqua/salframe.h
index e6dcde3..39d9496 100644
--- a/vcl/inc/aqua/salframe.h
+++ b/vcl/inc/aqua/salframe.h
@@ -138,6 +138,7 @@
virtual sal_Bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode );
virtual LanguageType GetInputLanguage();
virtual void UpdateSettings( AllSettings& rSettings );
+ virtual void Beep();
virtual const SystemEnvData* GetSystemData() const;
virtual SalPointerState GetPointerState();
virtual SalIndicatorState GetIndicatorState();
diff --git a/vcl/inc/headless/svpframe.hxx b/vcl/inc/headless/svpframe.hxx
index 4c073d5..342f542 100644
--- a/vcl/inc/headless/svpframe.hxx
+++ b/vcl/inc/headless/svpframe.hxx
@@ -106,6 +106,7 @@
virtual sal_Bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode );
virtual LanguageType GetInputLanguage();
virtual void UpdateSettings( AllSettings& rSettings );
+ virtual void Beep();
virtual const SystemEnvData* GetSystemData() const;
virtual SalPointerState GetPointerState();
virtual SalIndicatorState GetIndicatorState();
diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx
index 1132c38..0e5a92bf 100644
--- a/vcl/inc/salframe.hxx
+++ b/vcl/inc/salframe.hxx
@@ -184,6 +184,8 @@
virtual void UpdateSettings( AllSettings& rSettings ) = 0;
+ virtual void Beep() = 0;
+
// returns system data (most prominent: window handle)
virtual const SystemEnvData*
GetSystemData() const = 0;
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 63d066a..9cf1467 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -406,6 +406,8 @@
virtual void UpdateSettings( AllSettings& rSettings );
+ virtual void Beep();
+
// returns system data (most prominent: window handle)
virtual const SystemEnvData* GetSystemData() const;
diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx
index b20684e..2511495 100644
--- a/vcl/inc/unx/saldisp.hxx
+++ b/vcl/inc/unx/saldisp.hxx
@@ -305,6 +305,8 @@
void DbgPrintDisplayEvent(const char *pComment, XEvent *pEvent) const;
#endif
+ void Beep() const;
+
void ModifierMapping();
void SimulateKeyPress( sal_uInt16 nKeyCode );
sal_uInt16 GetIndicatorState() const;
diff --git a/vcl/inc/unx/salframe.h b/vcl/inc/unx/salframe.h
index a886864..28a5446 100644
--- a/vcl/inc/unx/salframe.h
+++ b/vcl/inc/unx/salframe.h
@@ -240,6 +240,7 @@
virtual sal_Bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode );
virtual LanguageType GetInputLanguage();
virtual void UpdateSettings( AllSettings& rSettings );
+ virtual void Beep();
virtual const SystemEnvData* GetSystemData() const;
virtual SalPointerState GetPointerState();
virtual SalIndicatorState GetIndicatorState();
diff --git a/vcl/inc/win/salframe.h b/vcl/inc/win/salframe.h
index 54e10bd..2a62219 100644
--- a/vcl/inc/win/salframe.h
+++ b/vcl/inc/win/salframe.h
@@ -121,6 +121,7 @@
virtual sal_Bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode );
virtual LanguageType GetInputLanguage();
virtual void UpdateSettings( AllSettings& rSettings );
+ virtual void Beep();
virtual const SystemEnvData* GetSystemData() const;
virtual SalPointerState GetPointerState();
virtual SalIndicatorState GetIndicatorState();
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index 0662899..fdc0c68 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -645,6 +645,12 @@
SetKbdExtension( pKbdExtension );
}
+// Sound
+void SalDisplay::Beep() const
+{
+ XBell( pDisp_, 100 );
+}
+
// Keyboard
namespace {
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index d614dd5..3ea0509 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -2522,6 +2522,12 @@
return true;
}
+// Sound
+void X11SalFrame::Beep()
+{
+ GetDisplay()->Beep();
+}
+
// Event Handling
static sal_uInt16 sal_GetCode( int state )
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 63df526..3e9da94 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -2651,6 +2651,11 @@
ReleaseGraphics( pGraphics );
}
+void GtkSalFrame::Beep()
+{
+ gdk_display_beep( getGdkDisplay() );
+}
+
const SystemEnvData* GtkSalFrame::GetSystemData() const
{
return &m_aSystemData;
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 5951b15..a668d72 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -2934,6 +2934,14 @@
// -----------------------------------------------------------------------
+void WinSalFrame::Beep()
+{
+ // a simple beep
+ MessageBeep( 0 );
+}
+
+// -----------------------------------------------------------------------
+
SalFrame::SalPointerState WinSalFrame::GetPointerState()
{
SalPointerState aState;
--
To view, visit https://gerrit.libreoffice.org/3124
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I663ffb7af75d2fd6d2c1f94073e4412d9744de4a
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Thomas Arnhold <thomas at arnhold.org>
More information about the LibreOffice
mailing list