summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/gtk/a11y/atkbridge.cxx3
-rw-r--r--vcl/unx/gtk/a11y/atktext.cxx136
-rw-r--r--vcl/unx/gtk/a11y/atktextattributes.cxx63
-rw-r--r--vcl/unx/gtk/a11y/atktextattributes.hxx5
-rw-r--r--vcl/unx/gtk/a11y/atkwindow.cxx26
-rw-r--r--vcl/unx/gtk/a11y/atkwrapper.cxx4
-rw-r--r--vcl/unx/gtk/app/gtkdata.cxx21
-rw-r--r--vcl/unx/gtk/window/gtkframe.cxx49
-rw-r--r--vcl/unx/inc/saldata.hxx4
-rw-r--r--vcl/unx/inc/wmadaptor.hxx24
-rw-r--r--vcl/unx/source/app/saldata.cxx1
-rw-r--r--vcl/unx/source/app/saldisp.cxx6
-rw-r--r--vcl/unx/source/app/wmadaptor.cxx89
-rw-r--r--vcl/unx/source/gdi/salgdi3.cxx38
-rw-r--r--vcl/unx/source/plugadapt/salplug.cxx8
-rw-r--r--vcl/unx/source/window/salframe.cxx142
16 files changed, 484 insertions, 135 deletions
diff --git a/vcl/unx/gtk/a11y/atkbridge.cxx b/vcl/unx/gtk/a11y/atkbridge.cxx
index 47efde7d3dfd..25add8e0dd18 100644
--- a/vcl/unx/gtk/a11y/atkbridge.cxx
+++ b/vcl/unx/gtk/a11y/atkbridge.cxx
@@ -40,10 +40,7 @@ bool InitAtkBridge(void)
{
const char* pVersion = atk_get_toolkit_version();
if( ! pVersion )
- {
- // g_warning( "unable to get gail version number" );
return false;
- }
unsigned int major, minor, micro;
diff --git a/vcl/unx/gtk/a11y/atktext.cxx b/vcl/unx/gtk/a11y/atktext.cxx
index f346a6a5a02c..e6d3276891de 100644
--- a/vcl/unx/gtk/a11y/atktext.cxx
+++ b/vcl/unx/gtk/a11y/atktext.cxx
@@ -454,6 +454,84 @@ text_wrapper_set_caret_offset (AtkText *text,
return FALSE;
}
+// --> OD 2010-03-04 #i92232#
+AtkAttributeSet*
+handle_text_markup_as_run_attribute( accessibility::XAccessibleTextMarkup* pTextMarkup,
+ const gint nTextMarkupType,
+ const gint offset,
+ AtkAttributeSet* pSet,
+ gint *start_offset,
+ gint *end_offset )
+{
+ const gint nTextMarkupCount( pTextMarkup->getTextMarkupCount( nTextMarkupType ) );
+ if ( nTextMarkupCount > 0 )
+ {
+ for ( gint nTextMarkupIndex = 0;
+ nTextMarkupIndex < nTextMarkupCount;
+ ++nTextMarkupIndex )
+ {
+ accessibility::TextSegment aTextSegment =
+ pTextMarkup->getTextMarkup( nTextMarkupIndex, nTextMarkupType );
+ const gint nStartOffsetTextMarkup = aTextSegment.SegmentStart;
+ const gint nEndOffsetTextMarkup = aTextSegment.SegmentEnd;
+ if ( nStartOffsetTextMarkup <= offset )
+ {
+ if ( offset < nEndOffsetTextMarkup )
+ {
+ // text markup at <offset>
+ *start_offset = ::std::max( *start_offset,
+ nStartOffsetTextMarkup );
+ *end_offset = ::std::min( *end_offset,
+ nEndOffsetTextMarkup );
+ switch ( nTextMarkupType )
+ {
+ case com::sun::star::text::TextMarkupType::SPELLCHECK:
+ {
+ pSet = attribute_set_prepend_misspelled( pSet );
+ }
+ break;
+ case com::sun::star::text::TextMarkupType::TRACK_CHANGE_INSERTION:
+ {
+ pSet = attribute_set_prepend_tracked_change_insertion( pSet );
+ }
+ break;
+ case com::sun::star::text::TextMarkupType::TRACK_CHANGE_DELETION:
+ {
+ pSet = attribute_set_prepend_tracked_change_deletion( pSet );
+ }
+ break;
+ case com::sun::star::text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
+ {
+ pSet = attribute_set_prepend_tracked_change_formatchange( pSet );
+ }
+ break;
+ default:
+ {
+ OSL_ASSERT( false );
+ }
+ }
+ break; // no further iteration needed.
+ }
+ else
+ {
+ *start_offset = ::std::max( *start_offset,
+ nEndOffsetTextMarkup );
+ // continue iteration.
+ }
+ }
+ else
+ {
+ *end_offset = ::std::min( *end_offset,
+ nStartOffsetTextMarkup );
+ break; // no further iteration.
+ }
+ } // eof iteration over text markups
+ }
+
+ return pSet;
+}
+// <--
+
static AtkAttributeSet *
text_wrapper_get_run_attributes( AtkText *text,
gint offset,
@@ -491,41 +569,41 @@ text_wrapper_get_run_attributes( AtkText *text,
}
}
- // Special handling for missspelled
+ // Special handling for misspelled text
+ // --> OD 2010-03-01 #i92232#
+ // - add special handling for tracked changes and refactor the
+ // corresponding code for handling misspelled text.
accessibility::XAccessibleTextMarkup* pTextMarkup = getTextMarkup( text );
if( pTextMarkup )
{
- uno::Sequence< accessibility::TextSegment > aTextSegmentSeq =
- pTextMarkup->getTextMarkupAtIndex( offset, com::sun::star::text::TextMarkupType::SPELLCHECK );
- if( aTextSegmentSeq.getLength() > 0 )
+ // Get attribute run here if it hasn't been done before
+ if( !bOffsetsAreValid )
{
- accessibility::TextSegment aTextSegment = aTextSegmentSeq[0];
- gint nStartOffsetMisspelled = aTextSegment.SegmentStart;
- gint nEndOffsetMisspelled = aTextSegment.SegmentEnd;
-
- // Get attribute run here if it hasn't been done before
- if( !bOffsetsAreValid )
- {
- accessibility::TextSegment aAttributeTextSegment =
- pText->getTextAtIndex(offset, accessibility::AccessibleTextType::ATTRIBUTE_RUN);
- *start_offset = aAttributeTextSegment.SegmentStart;
- *end_offset = aAttributeTextSegment.SegmentEnd;
- }
-
- if( nEndOffsetMisspelled <= offset )
- *start_offset = ::std::max( *start_offset, nEndOffsetMisspelled );
- else if( nStartOffsetMisspelled <= offset )
- *start_offset = ::std::max( *start_offset, nStartOffsetMisspelled );
-
- if( nStartOffsetMisspelled > offset )
- *end_offset = ::std::min( *end_offset, nStartOffsetMisspelled );
- else if( nEndOffsetMisspelled > offset )
- *end_offset = ::std::min( *end_offset, nEndOffsetMisspelled );
-
- if( nStartOffsetMisspelled <= offset && nEndOffsetMisspelled > offset )
- pSet = attribute_set_prepend_misspelled( pSet );
+ accessibility::TextSegment aAttributeTextSegment =
+ pText->getTextAtIndex(offset, accessibility::AccessibleTextType::ATTRIBUTE_RUN);
+ *start_offset = aAttributeTextSegment.SegmentStart;
+ *end_offset = aAttributeTextSegment.SegmentEnd;
}
+ // handle misspelled text
+ pSet = handle_text_markup_as_run_attribute(
+ pTextMarkup,
+ com::sun::star::text::TextMarkupType::SPELLCHECK,
+ offset, pSet, start_offset, end_offset );
+ // handle tracked changes
+ pSet = handle_text_markup_as_run_attribute(
+ pTextMarkup,
+ com::sun::star::text::TextMarkupType::TRACK_CHANGE_INSERTION,
+ offset, pSet, start_offset, end_offset );
+ pSet = handle_text_markup_as_run_attribute(
+ pTextMarkup,
+ com::sun::star::text::TextMarkupType::TRACK_CHANGE_DELETION,
+ offset, pSet, start_offset, end_offset );
+ pSet = handle_text_markup_as_run_attribute(
+ pTextMarkup,
+ com::sun::star::text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE,
+ offset, pSet, start_offset, end_offset );
}
+ // <--
}
catch(const uno::Exception& e){
diff --git a/vcl/unx/gtk/a11y/atktextattributes.cxx b/vcl/unx/gtk/a11y/atktextattributes.cxx
index 02624a9628cf..04498810597f 100644
--- a/vcl/unx/gtk/a11y/atktextattributes.cxx
+++ b/vcl/unx/gtk/a11y/atktextattributes.cxx
@@ -74,6 +74,12 @@ static AtkTextAttribute atk_text_attribute_tab_stops = ATK_TEXT_ATTR_INVALID;
static AtkTextAttribute atk_text_attribute_writing_mode = ATK_TEXT_ATTR_INVALID;
static AtkTextAttribute atk_text_attribute_vertical_align = ATK_TEXT_ATTR_INVALID;
static AtkTextAttribute atk_text_attribute_misspelled = ATK_TEXT_ATTR_INVALID;
+// --> OD 2010-03-01 #i92232#
+static AtkTextAttribute atk_text_attribute_tracked_change = ATK_TEXT_ATTR_INVALID;
+// <--
+// --> OD 2010-03-05 #i92233#
+static AtkTextAttribute atk_text_attribute_mm_to_pixel_ratio = ATK_TEXT_ATTR_INVALID;
+// <--
/*****************************************************************************/
@@ -103,6 +109,9 @@ enum ExportedAttribute
TEXT_ATTRIBUTE_STRIKETHROUGH,
TEXT_ATTRIBUTE_UNDERLINE,
TEXT_ATTRIBUTE_WEIGHT,
+ // --> OD 2010-03-05 #i92233#
+ TEXT_ATTRIBUTE_MM_TO_PIXEL_RATIO,
+ // <--
TEXT_ATTRIBUTE_JUSTIFICATION,
TEXT_ATTRIBUTE_BOTTOM_MARGIN,
TEXT_ATTRIBUTE_FIRST_LINE_INDENT,
@@ -137,6 +146,9 @@ static const char * ExportedTextAttributes[TEXT_ATTRIBUTE_LAST] =
"CharStrikeout", // TEXT_ATTRIBUTE_STRIKETHROUGH
"CharUnderline", // TEXT_ATTRIBUTE_UNDERLINE
"CharWeight", // TEXT_ATTRIBUTE_WEIGHT
+ // --> OD 2010-03-05 #i92233#
+ "MMToPixelRatio", // TEXT_ATTRIBUTE_MM_TO_PIXEL_RATIO
+ // <--
"ParaAdjust", // TEXT_ATTRIBUTE_JUSTIFICATION
"ParaBottomMargin", // TEXT_ATTRIBUTE_BOTTOM_MARGIN
"ParaFirstLineIndent", // TEXT_ATTRIBUTE_FIRST_LINE_INDENT
@@ -1293,6 +1305,14 @@ attribute_set_new_from_property_values(
attribute_set = attribute_set_prepend(attribute_set, atk_text_attribute_tab_stops,
get_value(rAttributeList, aIndexList[TEXT_ATTRIBUTE_TAB_STOPS], TabStops2String));
+ // --> OD 2010-03-05 #i92233#
+ if( ATK_TEXT_ATTR_INVALID == atk_text_attribute_mm_to_pixel_ratio )
+ atk_text_attribute_mm_to_pixel_ratio = atk_text_attribute_register("mm-to-pixel-ratio");
+
+ attribute_set = attribute_set_prepend( attribute_set, atk_text_attribute_mm_to_pixel_ratio,
+ get_value(rAttributeList, aIndexList[TEXT_ATTRIBUTE_MM_TO_PIXEL_RATIO], Float2String));
+ // <--
+
return attribute_set;
}
@@ -1308,6 +1328,49 @@ AtkAttributeSet* attribute_set_prepend_misspelled( AtkAttributeSet* attribute_se
return attribute_set;
}
+// --> OD 2010-03-01 #i92232#
+AtkAttributeSet* attribute_set_prepend_tracked_change_insertion( AtkAttributeSet* attribute_set )
+{
+ if ( ATK_TEXT_ATTR_INVALID == atk_text_attribute_tracked_change )
+ {
+ atk_text_attribute_tracked_change = atk_text_attribute_register( "text-tracked-change" );
+ }
+
+ attribute_set = attribute_set_prepend( attribute_set,
+ atk_text_attribute_tracked_change,
+ g_strdup_printf( "insertion" ) );
+
+ return attribute_set;
+}
+
+AtkAttributeSet* attribute_set_prepend_tracked_change_deletion( AtkAttributeSet* attribute_set )
+{
+ if ( ATK_TEXT_ATTR_INVALID == atk_text_attribute_tracked_change )
+ {
+ atk_text_attribute_tracked_change = atk_text_attribute_register( "text-tracked-change" );
+ }
+
+ attribute_set = attribute_set_prepend( attribute_set,
+ atk_text_attribute_tracked_change,
+ g_strdup_printf( "deletion" ) );
+
+ return attribute_set;
+}
+
+AtkAttributeSet* attribute_set_prepend_tracked_change_formatchange( AtkAttributeSet* attribute_set )
+{
+ if ( ATK_TEXT_ATTR_INVALID == atk_text_attribute_tracked_change )
+ {
+ atk_text_attribute_tracked_change = atk_text_attribute_register( "text-tracked-change" );
+ }
+
+ attribute_set = attribute_set_prepend( attribute_set,
+ atk_text_attribute_tracked_change,
+ g_strdup_printf( "attribute-change" ) );
+
+ return attribute_set;
+}
+// <--
/*****************************************************************************/
diff --git a/vcl/unx/gtk/a11y/atktextattributes.hxx b/vcl/unx/gtk/a11y/atktextattributes.hxx
index e363460bb578..9c7628bf927e 100644
--- a/vcl/unx/gtk/a11y/atktextattributes.hxx
+++ b/vcl/unx/gtk/a11y/atktextattributes.hxx
@@ -45,5 +45,10 @@ attribute_set_map_to_property_values(
com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rValueList );
AtkAttributeSet* attribute_set_prepend_misspelled( AtkAttributeSet* attribute_set );
+// --> OD 2010-03-01 #i92232#
+AtkAttributeSet* attribute_set_prepend_tracked_change_insertion( AtkAttributeSet* attribute_set );
+AtkAttributeSet* attribute_set_prepend_tracked_change_deletion( AtkAttributeSet* attribute_set );
+AtkAttributeSet* attribute_set_prepend_tracked_change_formatchange( AtkAttributeSet* attribute_set );
+// <--
#endif
diff --git a/vcl/unx/gtk/a11y/atkwindow.cxx b/vcl/unx/gtk/a11y/atkwindow.cxx
index f588c1e345e4..5448235998e8 100644
--- a/vcl/unx/gtk/a11y/atkwindow.cxx
+++ b/vcl/unx/gtk/a11y/atkwindow.cxx
@@ -143,6 +143,22 @@ ooo_window_wrapper_real_focus_gtk (GtkWidget *, GdkEventFocus *)
return FALSE;
}
+static gboolean ooo_tooltip_map( GtkWidget* pToolTip, gpointer )
+{
+ AtkObject* pAccessible = gtk_widget_get_accessible( pToolTip );
+ if( pAccessible )
+ atk_object_notify_state_change( pAccessible, ATK_STATE_SHOWING, TRUE );
+ return FALSE;
+}
+
+static gboolean ooo_tooltip_unmap( GtkWidget* pToolTip, gpointer )
+{
+ AtkObject* pAccessible = gtk_widget_get_accessible( pToolTip );
+ if( pAccessible )
+ atk_object_notify_state_change( pAccessible, ATK_STATE_SHOWING, FALSE );
+ return FALSE;
+}
+
/*****************************************************************************/
static bool
@@ -208,6 +224,16 @@ ooo_window_wrapper_real_initialize(AtkObject *obj, gpointer data)
g_signal_connect_after( GTK_WIDGET( data ), "focus-out-event",
G_CALLBACK (ooo_window_wrapper_real_focus_gtk),
NULL);
+
+ if( obj->role == ATK_ROLE_TOOL_TIP )
+ {
+ g_signal_connect_after( GTK_WIDGET( data ), "map-event",
+ G_CALLBACK (ooo_tooltip_map),
+ NULL);
+ g_signal_connect_after( GTK_WIDGET( data ), "unmap-event",
+ G_CALLBACK (ooo_tooltip_unmap),
+ NULL);
+ }
}
/*****************************************************************************/
diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx
index 5beb838c0e82..10f75309708d 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.cxx
@@ -283,7 +283,9 @@ static AtkRole mapToAtkRole( sal_Int16 nRole )
ATK_ROLE_RULER,
ATK_ROLE_UNKNOWN, // SECTION - registered below
ATK_ROLE_UNKNOWN, // TREE_ITEM - registered below
- ATK_ROLE_TREE_TABLE
+ ATK_ROLE_TREE_TABLE,
+ ATK_ROLE_SCROLL_PANE, // COMMENT - mapped to atk_role_scroll_pane
+ ATK_ROLE_UNKNOWN // COMMENT_END - mapped to atk_role_unknown
};
static bool initialized = false;
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index d1e5c5954352..f63f999738a7 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -800,15 +800,12 @@ void GtkXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
*/
bool bDispatchThread = false;
+ gboolean wasEvent = FALSE;
{
// release YieldMutex (and re-acquire at block end)
YieldMutexReleaser aReleaser;
if( osl_tryToAcquireMutex( m_aDispatchMutex ) )
- {
- // we are the dispatch thread
- osl_resetCondition( m_aDispatchCondition );
bDispatchThread = true;
- }
else if( ! bWait )
return; // someone else is waiting already, return
@@ -816,7 +813,7 @@ void GtkXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
if( bDispatchThread )
{
int nMaxEvents = bHandleAllCurrentEvents ? 100 : 1;
- gboolean wasEvent = FALSE, wasOneEvent = TRUE;
+ gboolean wasOneEvent = TRUE;
while( nMaxEvents-- && wasOneEvent )
{
wasOneEvent = g_main_context_iteration( NULL, FALSE );
@@ -824,17 +821,17 @@ void GtkXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
wasEvent = TRUE;
}
if( bWait && ! wasEvent )
- g_main_context_iteration( NULL, TRUE );
+ wasEvent = g_main_context_iteration( NULL, TRUE );
}
- else if( userEventFn( this ) )
+ else if( bWait )
{
/* #i41693# in case the dispatch thread hangs in join
* for this thread the condition will never be set
* workaround: timeout of 1 second a emergency exit
*/
- TimeValue aValue;
- aValue.Seconds = 1;
- aValue.Nanosec = 0;
+ // we are the dispatch thread
+ osl_resetCondition( m_aDispatchCondition );
+ TimeValue aValue = { 1, 0 };
osl_waitCondition( m_aDispatchCondition, &aValue );
}
}
@@ -842,8 +839,8 @@ void GtkXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
if( bDispatchThread )
{
osl_releaseMutex( m_aDispatchMutex );
- osl_setCondition( m_aDispatchCondition ); // trigger non dispatch thread yields
- osl_resetCondition( m_aDispatchCondition );
+ if( wasEvent )
+ osl_setCondition( m_aDispatchCondition ); // trigger non dispatch thread yields
}
}
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index ef356eb57aa9..16e478c22f6e 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -690,7 +690,7 @@ static void lcl_set_accept_focus( GtkWindow* pWindow, gboolean bAccept, bool bBe
XFree( pHints );
if (GetX11SalData()->GetDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("compiz"))
- return;
+ return;
/* remove WM_TAKE_FOCUS protocol; this would usually be the
* right thing, but gtk handles it internally whereas we
@@ -844,7 +844,8 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle )
eType = GDK_WINDOW_TYPE_HINT_UTILITY;
}
- if( (nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) )
+ if( (nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN )
+ && getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
{
eType = GDK_WINDOW_TYPE_HINT_TOOLBAR;
gtk_window_set_keep_above( GTK_WINDOW(m_pWindow), true );
@@ -1304,7 +1305,8 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate )
{
if( m_pWindow )
{
- if( m_pParent && (m_pParent->m_nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN) )
+ if( m_pParent && (m_pParent->m_nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN)
+ && getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
gtk_window_set_keep_above( GTK_WINDOW(m_pWindow), bVisible );
if( bVisible )
{
@@ -1465,6 +1467,12 @@ void GtkSalFrame::setMinMaxSize()
aHints |= GDK_HINT_MAX_SIZE;
}
}
+ if( m_bFullscreen )
+ {
+ aGeo.max_width = m_aMaxSize.Width();
+ aGeo.max_height = m_aMaxSize.Height();
+ aHints |= GDK_HINT_MAX_SIZE;
+ }
if( aHints )
gtk_window_set_geometry_hints( GTK_WINDOW(m_pWindow),
NULL,
@@ -1816,8 +1824,6 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen )
{
m_aRestorePosSize = Rectangle( Point( maGeometry.nX, maGeometry.nY ),
Size( maGeometry.nWidth, maGeometry.nHeight ) );
- // workaround different window managers have different opinions about
- // _NET_WM_STATE_FULLSCREEN (Metacity <-> KWin)
bool bVisible = GTK_WIDGET_MAPPED(m_pWindow);
if( bVisible )
Show( FALSE );
@@ -1834,12 +1840,22 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen )
gtk_window_move( GTK_WINDOW(m_pWindow),
maGeometry.nX = aNewPosSize.Left(),
maGeometry.nY = aNewPosSize.Top() );
+ // #i110881# for the benefit of compiz set a max size here
+ // else setting to fullscreen fails for unknown reasons
+ m_aMaxSize.Width() = aNewPosSize.GetWidth()+100;
+ m_aMaxSize.Height() = aNewPosSize.GetHeight()+100;
+ // workaround different legacy version window managers have different opinions about
+ // _NET_WM_STATE_FULLSCREEN (Metacity <-> KWin)
+ if( ! getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
+ gtk_window_fullscreen( GTK_WINDOW( m_pWindow ) );
if( bVisible )
Show( TRUE );
}
else
{
bool bVisible = GTK_WIDGET_MAPPED(m_pWindow);
+ if( ! getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
+ gtk_window_unfullscreen( GTK_WINDOW(m_pWindow) );
if( bVisible )
Show( FALSE );
m_nStyle &= ~SAL_FRAME_STYLE_PARTIAL_FULLSCREEN;
@@ -1862,8 +1878,11 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen )
{
if( bFullScreen )
{
- if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) )
- gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE );
+ if( getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
+ {
+ if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) )
+ gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE );
+ }
gtk_window_fullscreen( GTK_WINDOW(m_pWindow) );
moveToScreen( nScreen );
Size aScreenSize = pDisp->GetScreenSize( m_nScreen );
@@ -1875,8 +1894,11 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen )
else
{
gtk_window_unfullscreen( GTK_WINDOW(m_pWindow) );
- if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) )
- gtk_window_set_resizable( GTK_WINDOW(m_pWindow), FALSE );
+ if( getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
+ {
+ if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) )
+ gtk_window_set_resizable( GTK_WINDOW(m_pWindow), FALSE );
+ }
moveToScreen( nScreen );
}
}
@@ -3184,6 +3206,15 @@ gboolean GtkSalFrame::signalState( GtkWidget*, GdkEvent* pEvent, gpointer frame
}
pThis->m_nState = pEvent->window_state.new_window_state;
+ #if OSL_DEBUG_LEVEL > 1
+ if( (pEvent->window_state.changed_mask & GDK_WINDOW_STATE_FULLSCREEN) )
+ {
+ fprintf( stderr, "window %p %s full screen state\n",
+ pThis,
+ (pEvent->window_state.new_window_state & GDK_WINDOW_STATE_FULLSCREEN) ? "enters" : "leaves");
+ }
+ #endif
+
return FALSE;
}
diff --git a/vcl/unx/inc/saldata.hxx b/vcl/unx/inc/saldata.hxx
index 3810558d470d..7e38e0a89bf2 100644
--- a/vcl/unx/inc/saldata.hxx
+++ b/vcl/unx/inc/saldata.hxx
@@ -62,6 +62,7 @@ protected:
SalXLib *pXLib_;
SalDisplay *m_pSalDisplay;
pthread_t hMainThread_;
+ rtl::OUString maLocalHostName;
public:
X11SalData();
@@ -87,6 +88,9 @@ public:
inline void StopTimer();
void Timeout() const;
+ const rtl::OUString& GetLocalHostName() const
+ { return maLocalHostName; }
+
static int XErrorHdl( Display*, XErrorEvent* );
static int XIOErrorHdl( Display* );
diff --git a/vcl/unx/inc/wmadaptor.hxx b/vcl/unx/inc/wmadaptor.hxx
index c628cfe091ef..cbedede2cc99 100644
--- a/vcl/unx/inc/wmadaptor.hxx
+++ b/vcl/unx/inc/wmadaptor.hxx
@@ -58,6 +58,8 @@ public:
NET_WM_NAME,
NET_WM_DESKTOP,
NET_WM_ICON_NAME,
+ NET_WM_PID,
+ NET_WM_PING,
NET_WM_STATE,
NET_WM_STATE_MAXIMIZED_HORZ,
NET_WM_STATE_MAXIMIZED_VERT,
@@ -160,6 +162,7 @@ protected:
m_aWMWorkAreas;
bool m_bTransientBehaviour;
bool m_bEnableAlwaysOnTopWorks;
+ bool m_bLegacyPartialFullscreen;
int m_nWinGravity;
int m_nInitWinGravity;
@@ -220,6 +223,18 @@ public:
virtual void setWMName( X11SalFrame* pFrame, const String& rWMName ) const;
/*
+ * set NET_WM_PID
+ */
+ virtual void setPID( X11SalFrame* pFrame ) const;
+
+ /*
+ * set WM_CLIENT_MACHINE
+ */
+ virtual void setClientMachine( X11SalFrame* pFrame ) const;
+
+ virtual void answerPing( X11SalFrame*, XClientMessageEvent* ) const;
+
+ /*
* maximizes frame
* maximization can be toggled in either direction
* to get the original position and size
@@ -231,6 +246,15 @@ public:
*/
virtual void showFullScreen( X11SalFrame* pFrame, bool bFullScreen ) const;
/*
+ * tell whether legacy partial full screen handling is necessary
+ * see #i107249#: NET_WM_STATE_FULLSCREEN is not well defined, but de facto
+ * modern WM's interpret it the "right" way, namely they make "full screen"
+ * taking twin view or Xinerama into accound and honor the positioning hints
+ * to see which screen actually was meant to use for fullscreen.
+ */
+ bool isLegacyPartialFullscreen() const
+ { return m_bLegacyPartialFullscreen; }
+ /*
* set window struts
*/
virtual void setFrameStruts( X11SalFrame*pFrame,
diff --git a/vcl/unx/source/app/saldata.cxx b/vcl/unx/source/app/saldata.cxx
index 4155887a9875..75d18de0787a 100644
--- a/vcl/unx/source/app/saldata.cxx
+++ b/vcl/unx/source/app/saldata.cxx
@@ -276,6 +276,7 @@ X11SalData::X11SalData()
m_pPlugin = NULL;
hMainThread_ = pthread_self();
+ osl_getLocalHostname( &maLocalHostName.pData );
}
X11SalData::~X11SalData()
diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx
index 2ed699ad0eb5..aa2afab93657 100644
--- a/vcl/unx/source/app/saldisp.cxx
+++ b/vcl/unx/source/app/saldisp.cxx
@@ -322,12 +322,12 @@ sal_IsLocalDisplay( Display *pDisplay )
if( pPtr != NULL )
{
- OUString aLocalHostname;
- if( osl_getLocalHostname( &aLocalHostname.pData ) == osl_Socket_Ok)
+ const OUString& rLocalHostname( GetX11SalData()->GetLocalHostName() );
+ if( rLocalHostname.getLength() )
{
*pPtr = '\0';
OUString aDisplayHostname( pDisplayHost, strlen( pDisplayHost ), osl_getThreadTextEncoding() );
- bEqual = sal_EqualHosts( aLocalHostname, aDisplayHostname );
+ bEqual = sal_EqualHosts( rLocalHostname, aDisplayHostname );
bEqual = bEqual && sal_IsDisplayNumber( pPtr + 1 );
}
}
diff --git a/vcl/unx/source/app/wmadaptor.cxx b/vcl/unx/source/app/wmadaptor.cxx
index 89c8bb56291c..fb2317e19573 100644
--- a/vcl/unx/source/app/wmadaptor.cxx
+++ b/vcl/unx/source/app/wmadaptor.cxx
@@ -34,6 +34,7 @@
#include <sal/alloca.h>
#include <wmadaptor.hxx>
#include <saldisp.hxx>
+#include <saldata.hxx>
#include <salframe.h>
#include <vcl/salgdi.hxx>
#include <osl/thread.h>
@@ -118,6 +119,7 @@ static const WMAdaptorProtocol aProtocolTab[] =
{ "_NET_NUMBER_OF_DESKTOPS", WMAdaptor::NET_NUMBER_OF_DESKTOPS },
{ "_NET_WM_DESKTOP", WMAdaptor::NET_WM_DESKTOP },
{ "_NET_WM_ICON_NAME", WMAdaptor::NET_WM_ICON_NAME },
+ { "_NET_WM_PING", WMAdaptor::NET_WM_PING },
{ "_NET_WM_STATE", WMAdaptor::NET_WM_STATE },
{ "_NET_WM_STATE_ABOVE", WMAdaptor::NET_WM_STATE_STAYS_ON_TOP },
{ "_NET_WM_STATE_FULLSCREEN", WMAdaptor::NET_WM_STATE_FULLSCREEN },
@@ -179,7 +181,8 @@ static const WMAdaptorProtocol aAtomTab[] =
{ "_XSETTINGS_SETTINGS", WMAdaptor::XSETTINGS },
{ "_XEMBED", WMAdaptor::XEMBED },
{ "_XEMBED_INFO", WMAdaptor::XEMBED_INFO },
- { "_NET_WM_USER_TIME", WMAdaptor::NET_WM_USER_TIME }
+ { "_NET_WM_USER_TIME", WMAdaptor::NET_WM_USER_TIME },
+ { "_NET_WM_PID", WMAdaptor::NET_WM_PID }
};
extern "C" {
@@ -233,6 +236,7 @@ WMAdaptor::WMAdaptor( SalDisplay* pDisplay ) :
m_pSalDisplay( pDisplay ),
m_bTransientBehaviour( true ),
m_bEnableAlwaysOnTopWorks( false ),
+ m_bLegacyPartialFullscreen( false ),
m_nWinGravity( StaticGravity ),
m_nInitWinGravity( StaticGravity )
{
@@ -909,6 +913,40 @@ bool WMAdaptor::getNetWmName()
XFree( pProperty );
pProperty = NULL;
}
+ // if this is metacity, check for version to enable a legacy workaround
+ if( m_aWMName.EqualsAscii( "Metacity" ) )
+ {
+ int nVersionMajor = 0, nVersionMinor = 0;
+ Atom nVersionAtom = XInternAtom( m_pDisplay, "_METACITY_VERSION", True );
+ if( nVersionAtom )
+ {
+ if( XGetWindowProperty( m_pDisplay,
+ aWMChild,
+ nVersionAtom,
+ 0, 256,
+ False,
+ m_aWMAtoms[ UTF8_STRING ],
+ &aRealType,
+ &nFormat,
+ &nItems,
+ &nBytesLeft,
+ &pProperty ) == 0
+ && nItems != 0
+ )
+ {
+ String aMetaVersion( (sal_Char*)pProperty, nItems, RTL_TEXTENCODING_UTF8 );
+ nVersionMajor = aMetaVersion.GetToken( 0, '.' ).ToInt32();
+ nVersionMinor = aMetaVersion.GetToken( 1, '.' ).ToInt32();
+ }
+ if( pProperty )
+ {
+ XFree( pProperty );
+ pProperty = NULL;
+ }
+ }
+ if( nVersionMajor < 2 || (nVersionMajor == 2 && nVersionMinor < 12) )
+ m_bLegacyPartialFullscreen = true;
+ }
}
}
else if( pProperty )
@@ -2412,3 +2450,52 @@ void NetWMAdaptor::setUserTime( X11SalFrame* i_pFrame, long i_nUserTime ) const
);
}
}
+
+/*
+ * WMAdaptor::setPID
+ */
+void WMAdaptor::setPID( X11SalFrame* i_pFrame ) const
+{
+ if( m_aWMAtoms[NET_WM_PID] )
+ {
+ long nPID = (long)getpid();
+ XChangeProperty( m_pDisplay,
+ i_pFrame->GetShellWindow(),
+ m_aWMAtoms[NET_WM_PID],
+ XA_CARDINAL,
+ 32,
+ PropModeReplace,
+ (unsigned char*)&nPID,
+ 1
+ );
+ }
+}
+
+/*
+* WMAdaptor::setClientMachine
+*/
+void WMAdaptor::setClientMachine( X11SalFrame* i_pFrame ) const
+{
+ rtl::OString aWmClient( rtl::OUStringToOString( GetX11SalData()->GetLocalHostName(), RTL_TEXTENCODING_ASCII_US ) );
+ XTextProperty aClientProp = { (unsigned char*)aWmClient.getStr(), XA_STRING, 8, aWmClient.getLength() };
+ XSetWMClientMachine( m_pDisplay, i_pFrame->GetShellWindow(), &aClientProp );
+}
+
+void WMAdaptor::answerPing( X11SalFrame* i_pFrame, XClientMessageEvent* i_pEvent ) const
+{
+ if( m_aWMAtoms[NET_WM_PING] &&
+ i_pEvent->message_type == m_aWMAtoms[ WM_PROTOCOLS ] &&
+ (Atom)i_pEvent->data.l[0] == m_aWMAtoms[ NET_WM_PING ] )
+ {
+ XEvent aEvent;
+ aEvent.xclient = *i_pEvent;
+ aEvent.xclient.window = m_pSalDisplay->GetRootWindow( i_pFrame->GetScreenNumber() );
+ XSendEvent( m_pDisplay,
+ m_pSalDisplay->GetRootWindow( i_pFrame->GetScreenNumber() ),
+ False,
+ SubstructureNotifyMask | SubstructureRedirectMask,
+ &aEvent
+ );
+ XFlush( m_pDisplay );
+ }
+}
diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx
index 7cf2009a3e07..f00ee26c0d4d 100644
--- a/vcl/unx/source/gdi/salgdi3.cxx
+++ b/vcl/unx/source/gdi/salgdi3.cxx
@@ -641,13 +641,11 @@ bool X11SalGraphics::setFont( const ImplFontSelectData *pEntry, int nFallbackLev
mpServerFont[ nFallbackLevel ] = pServerFont;
// apply font specific-hint settings if needed
+ // TODO: also disable it for reference devices
if( !bPrinter_ )
{
- // TODO: is it worth it to cache the hint settings, e.g. in the ImplFontEntry?
- ImplFontOptions aFontOptions;
- bool GetFCFontOptions( const ImplFontAttributes&, int nSize, ImplFontOptions&);
- if( GetFCFontOptions( *pEntry->mpFontData, pEntry->mnHeight, aFontOptions ) )
- pServerFont->SetFontOptions( aFontOptions );
+ ImplServerFontEntry* pSFE = static_cast<ImplServerFontEntry*>( pEntry->mpFontEntry );
+ pSFE->HandleFontOptions();
}
return true;
@@ -656,6 +654,24 @@ bool X11SalGraphics::setFont( const ImplFontSelectData *pEntry, int nFallbackLev
return false;
}
+void ImplServerFontEntry::HandleFontOptions( void )
+{
+ bool GetFCFontOptions( const ImplFontAttributes&, int nSize, ImplFontOptions& );
+
+ if( !mpServerFont )
+ return;
+ if( !mbGotFontOptions )
+ {
+ // get and cache the font options
+ mbGotFontOptions = true;
+ mbValidFontOptions = GetFCFontOptions( *maFontSelData.mpFontData,
+ maFontSelData.mnHeight, maFontOptions );
+ }
+ // apply the font options
+ if( mbValidFontOptions )
+ mpServerFont->SetFontOptions( maFontOptions );
+}
+
//--------------------------------------------------------------------------
inline sal_Unicode SwapBytes( const sal_Unicode nIn )
@@ -1633,11 +1649,13 @@ void X11SalGraphics::GetDevFontSubstList( OutputDevice* )
void cairosubcallback( void* pPattern )
{
CairoWrapper& rCairo = CairoWrapper::get();
- if( rCairo.isValid() )
- {
+ if( !rCairo.isValid() )
+ return;
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
- rCairo.ft_font_options_substitute( rStyleSettings.GetCairoFontOptions(), pPattern);
- }
+ const void* pFontOptions = rStyleSettings.GetCairoFontOptions();
+ if( !pFontOptions )
+ return;
+ rCairo.ft_font_options_substitute( pFontOptions, pPattern );
}
bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize,
@@ -1664,7 +1682,6 @@ bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize,
default:
aInfo.m_eItalic = psp::italic::Unknown;
break;
-
}
// set weight
switch( rFontAttributes.GetWeight() )
@@ -1740,7 +1757,6 @@ bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize,
const psp::PrintFontManager& rPFM = psp::PrintFontManager::get();
bool bOK = rPFM.getFontOptions( aInfo, nSize, cairosubcallback, rFontOptions);
-
return bOK;
}
diff --git a/vcl/unx/source/plugadapt/salplug.cxx b/vcl/unx/source/plugadapt/salplug.cxx
index c42c22bc0592..a438760cffba 100644
--- a/vcl/unx/source/plugadapt/salplug.cxx
+++ b/vcl/unx/source/plugadapt/salplug.cxx
@@ -98,6 +98,14 @@ static SalInstance* tryInstance( const OUString& rModuleBase )
{
pCloseModule = NULL;
}
+ /*
+ * #i109007# KDE3 seems to have the same problem; an atexit cleanup
+ * handler, which cannot be resolved anymore if the plugin is already unloaded.
+ */
+ else if( rModuleBase.equalsAscii("kde") )
+ {
+ pCloseModule = NULL;
+ }
GetSalData()->m_pPlugin = aMod;
}
diff --git a/vcl/unx/source/window/salframe.cxx b/vcl/unx/source/window/salframe.cxx
index 5b538626a634..6d243e41db8c 100644
--- a/vcl/unx/source/window/salframe.cxx
+++ b/vcl/unx/source/window/salframe.cxx
@@ -528,6 +528,8 @@ void X11SalFrame::Init( ULONG nSalFrameStyle, int nScreen, SystemParentData* pPa
Atom a[4];
int n = 0;
a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::WM_DELETE_WINDOW );
+ if( pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING ) )
+ a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING );
if( ! s_pSaveYourselfFrame && ! mpParent)
{
// at all times have only one frame with SaveYourself
@@ -549,11 +551,23 @@ void X11SalFrame::Init( ULONG nSalFrameStyle, int nScreen, SystemParentData* pPa
pHints->win_gravity = GetDisplay()->getWMAdaptor()->getPositionWinGravity();
pHints->x = 0;
pHints->y = 0;
+ if( mbFullScreen )
+ {
+ pHints->flags |= PMaxSize | PMinSize;
+ pHints->max_width = w+100;
+ pHints->max_height = h+100;
+ pHints->min_width = w;
+ pHints->min_height = h;
+ }
XSetWMNormalHints( GetXDisplay(),
GetShellWindow(),
pHints );
XFree (pHints);
+ // set PID and WM_CLIENT_MACHINE
+ pDisplay_->getWMAdaptor()->setClientMachine( this );
+ pDisplay_->getWMAdaptor()->setPID( this );
+
// set client leader
if( aClientLeader )
{
@@ -605,7 +619,8 @@ void X11SalFrame::Init( ULONG nSalFrameStyle, int nScreen, SystemParentData* pPa
eType = WMAdaptor::windowType_Utility;
if( nStyle_ & SAL_FRAME_STYLE_OWNERDRAWDECORATION )
eType = WMAdaptor::windowType_Toolbar;
- if( nStyle_ & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN )
+ if( (nStyle_ & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN)
+ && GetDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
eType = WMAdaptor::windowType_Dock;
GetDisplay()->getWMAdaptor()->
@@ -735,6 +750,8 @@ void X11SalFrame::passOnSaveYourSelf()
int n = 0;
a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::WM_DELETE_WINDOW );
a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::WM_SAVE_YOURSELF );
+ if( pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING ) )
+ a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING );
XSetWMProtocols( GetXDisplay(), s_pSaveYourselfFrame->GetShellWindow(), a, n );
}
}
@@ -1130,7 +1147,7 @@ void X11SalFrame::Show( BOOL bVisible, BOOL bNoActivate )
// even though transient frames should be kept above their parent
// this does not necessarily hold true for DOCK type windows
// so artificially set ABOVE and remove it again on hide
- if( mpParent && (mpParent->nStyle_ & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) )
+ if( mpParent && (mpParent->nStyle_ & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) && pDisplay_->getWMAdaptor()->isLegacyPartialFullscreen())
pDisplay_->getWMAdaptor()->enableAlwaysOnTop( this, bVisible );
bMapped_ = bVisible;
@@ -1322,11 +1339,6 @@ void X11SalFrame::Show( BOOL bVisible, BOOL bNoActivate )
}
else
{
-#if OSL_DEBUG_LEVEL > 1
- if( nStyle_ & SAL_FRAME_STYLE_OWNERDRAWDECORATION )
- fprintf( stderr, "hide on ownerdraw\n" );
-#endif
-
if( getInputContext() )
getInputContext()->Unmap( this );
@@ -1616,6 +1628,7 @@ void X11SalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, USHOR
}
else
SetPosSize( aPosSize );
+
bDefaultPosition_ = False;
}
@@ -2042,6 +2055,12 @@ void X11SalFrame::SetPosSize( const Rectangle &rPosSize )
pHints->y = values.y;
pHints->win_gravity = pDisplay_->getWMAdaptor()->getPositionWinGravity();
}
+ if( mbFullScreen )
+ {
+ pHints->max_width = 10000;
+ pHints->max_height = 10000;
+ pHints->flags |= PMaxSize;
+ }
XSetWMNormalHints( GetXDisplay(),
GetShellWindow(),
pHints );
@@ -2199,28 +2218,15 @@ void X11SalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen )
maGeometry.nWidth = aRect.GetWidth();
maGeometry.nHeight = aRect.GetHeight();
mbMaximizedHorz = mbMaximizedVert = false;
+ mbFullScreen = true;
createNewWindow( None, m_nScreen );
- GetDisplay()->getWMAdaptor()->enableAlwaysOnTop( this, true );
- #if 0
- // this would give additional intent to the window
- // manager to force the positioning of the window;
- // alas all other windows will be expunged from that
- // region, leaving us in a pity state afterwards
- Size aScreenSize = pDisplay_->GetScreenSize( m_nScreen );
- pDisplay_->getWMAdaptor()->setFrameStruts( this,
- aRect.Left(), aRect.Top(),
- aScreenSize.Width() - aRect.Right(),
- aScreenSize.Height() - aRect.Bottom(),
- aRect.Left(), aRect.Right(),
- aRect.Top(), aRect.Bottom(),
- aRect.Left(), aRect.Right(),
- aRect.Top(), aRect.Bottom()
- );
- #endif
-
+ if( GetDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
+ GetDisplay()->getWMAdaptor()->enableAlwaysOnTop( this, true );
+ else
+ GetDisplay()->getWMAdaptor()->showFullScreen( this, true );
if( bVisible )
Show(TRUE);
- mbFullScreen = true;
+
}
else
{
@@ -3927,52 +3933,56 @@ long X11SalFrame::HandleClientMessage( XClientMessageEvent *pEvent )
Close(); // ???
return 1;
}
- else if( pEvent->message_type == rWMAdaptor.getAtom( WMAdaptor::WM_PROTOCOLS )
- && ! ( nStyle_ & SAL_FRAME_STYLE_PLUG )
- && ! (( nStyle_ & SAL_FRAME_STYLE_FLOAT ) && (nStyle_ & SAL_FRAME_STYLE_OWNERDRAWDECORATION))
- )
+ else if( pEvent->message_type == rWMAdaptor.getAtom( WMAdaptor::WM_PROTOCOLS ) )
{
- if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_DELETE_WINDOW ) )
- {
- Close();
- return 1;
- }
- else if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_TAKE_FOCUS ) )
- {
- // do nothing, we set the input focus in ToTop() if necessary
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "got WM_TAKE_FOCUS on %s window\n",
- (nStyle_&SAL_FRAME_STYLE_OWNERDRAWDECORATION) ?
- "ownerdraw" : "NON OWNERDRAW" );
-#endif
- }
- else if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_SAVE_YOURSELF ) )
+ if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::NET_WM_PING ) )
+ rWMAdaptor.answerPing( this, pEvent );
+ else if( ! ( nStyle_ & SAL_FRAME_STYLE_PLUG )
+ && ! (( nStyle_ & SAL_FRAME_STYLE_FLOAT ) && (nStyle_ & SAL_FRAME_STYLE_OWNERDRAWDECORATION))
+ )
{
- bool bSession = rWMAdaptor.getWindowManagerName().EqualsAscii( "Dtwm" );
-
- if( ! bSession )
+ if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_DELETE_WINDOW ) )
+ {
+ Close();
+ return 1;
+ }
+ else if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_TAKE_FOCUS ) )
{
- if( this == s_pSaveYourselfFrame )
+ // do nothing, we set the input focus in ToTop() if necessary
+ #if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, "got WM_TAKE_FOCUS on %s window\n",
+ (nStyle_&SAL_FRAME_STYLE_OWNERDRAWDECORATION) ?
+ "ownerdraw" : "NON OWNERDRAW" );
+ #endif
+ }
+ else if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_SAVE_YOURSELF ) )
+ {
+ bool bSession = rWMAdaptor.getWindowManagerName().EqualsAscii( "Dtwm" );
+
+ if( ! bSession )
{
- ByteString aExec( SessionManagerClient::getExecName(), osl_getThreadTextEncoding() );
- const char* argv[2];
- argv[0] = "/bin/sh";
- argv[1] = const_cast<char*>(aExec.GetBuffer());
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "SaveYourself request, setting command: %s %s\n", argv[0], argv[1] );
-#endif
- XSetCommand( GetXDisplay(), GetShellWindow(), (char**)argv, 2 );
+ if( this == s_pSaveYourselfFrame )
+ {
+ ByteString aExec( SessionManagerClient::getExecName(), osl_getThreadTextEncoding() );
+ const char* argv[2];
+ argv[0] = "/bin/sh";
+ argv[1] = const_cast<char*>(aExec.GetBuffer());
+ #if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, "SaveYourself request, setting command: %s %s\n", argv[0], argv[1] );
+ #endif
+ XSetCommand( GetXDisplay(), GetShellWindow(), (char**)argv, 2 );
+ }
+ else
+ // can only happen in race between WM and window closing
+ XChangeProperty( GetXDisplay(), GetShellWindow(), rWMAdaptor.getAtom( WMAdaptor::WM_COMMAND ), XA_STRING, 8, PropModeReplace, (unsigned char*)"", 0 );
}
else
- // can only happen in race between WM and window closing
- XChangeProperty( GetXDisplay(), GetShellWindow(), rWMAdaptor.getAtom( WMAdaptor::WM_COMMAND ), XA_STRING, 8, PropModeReplace, (unsigned char*)"", 0 );
- }
- else
- {
- // save open documents; would be good for non Dtwm, too,
- // but there is no real Shutdown message in the ancient
- // SM protocol; on Dtwm SaveYourself really means Shutdown, too.
- IceSalSession::handleOldX11SaveYourself( this );
+ {
+ // save open documents; would be good for non Dtwm, too,
+ // but there is no real Shutdown message in the ancient
+ // SM protocol; on Dtwm SaveYourself really means Shutdown, too.
+ IceSalSession::handleOldX11SaveYourself( this );
+ }
}
}
}