[wxGTK] Remove wxTLW::RequestUserAttention related backwards compatibility hacks
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35637 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -62,9 +62,7 @@ public:
|
|||||||
|
|
||||||
virtual bool SetShape(const wxRegion& region);
|
virtual bool SetShape(const wxRegion& region);
|
||||||
|
|
||||||
#if wxABI_VERSION >= 20602
|
|
||||||
virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO);
|
virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO);
|
||||||
#endif
|
|
||||||
|
|
||||||
virtual bool Show(bool show = TRUE);
|
virtual bool Show(bool show = TRUE);
|
||||||
|
|
||||||
@@ -110,6 +108,10 @@ public:
|
|||||||
long m_gdkFunc,
|
long m_gdkFunc,
|
||||||
m_gdkDecor;
|
m_gdkDecor;
|
||||||
|
|
||||||
|
// private gtk_timeout_add result for mimicing wxUSER_ATTENTION_INFO and
|
||||||
|
// wxUSER_ATTENTION_ERROR difference, -2 for no hint, -1 for ERROR hint, rest for GtkTimeout handle.
|
||||||
|
int m_urgency_hint;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
@@ -62,9 +62,7 @@ public:
|
|||||||
|
|
||||||
virtual bool SetShape(const wxRegion& region);
|
virtual bool SetShape(const wxRegion& region);
|
||||||
|
|
||||||
#if wxABI_VERSION >= 20602
|
|
||||||
virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO);
|
virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO);
|
||||||
#endif
|
|
||||||
|
|
||||||
virtual bool Show(bool show = TRUE);
|
virtual bool Show(bool show = TRUE);
|
||||||
|
|
||||||
@@ -110,6 +108,10 @@ public:
|
|||||||
long m_gdkFunc,
|
long m_gdkFunc,
|
||||||
m_gdkDecor;
|
m_gdkDecor;
|
||||||
|
|
||||||
|
// private gtk_timeout_add result for mimicing wxUSER_ATTENTION_INFO and
|
||||||
|
// wxUSER_ATTENTION_ERROR difference, -2 for no hint, -1 for ERROR hint, rest for GtkTimeout handle.
|
||||||
|
int m_urgency_hint;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
@@ -105,17 +105,16 @@ static void wxgtk_window_set_urgency_hint (GtkWindow *win,
|
|||||||
XFree(wm_hints);
|
XFree(wm_hints);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint gtk_frame_urgency_timer_callback( GtkWidget *win )
|
static gint gtk_frame_urgency_timer_callback( wxTopLevelWindowGTK *win )
|
||||||
{
|
{
|
||||||
#if defined(__WXGTK20__) && GTK_CHECK_VERSION(2,7,0)
|
#if defined(__WXGTK20__) && GTK_CHECK_VERSION(2,7,0)
|
||||||
if(!gtk_check_version(2,7,0))
|
if(!gtk_check_version(2,7,0))
|
||||||
gtk_window_set_urgency_hint(GTK_WINDOW( win ), FALSE);
|
gtk_window_set_urgency_hint(GTK_WINDOW( win->m_widget ), FALSE);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
wxgtk_window_set_urgency_hint(GTK_WINDOW( win ), FALSE);
|
wxgtk_window_set_urgency_hint(GTK_WINDOW( win->m_widget ), FALSE);
|
||||||
|
|
||||||
//BCI: argument from GtkWidget* to wxTopLevelWindowGTK* && win->m_urgency_hint = -2;
|
win->m_urgency_hint = -2;
|
||||||
gtk_object_set_data(GTK_OBJECT(win), "m_urgency_hint", GINT_TO_POINTER(-2));
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,12 +151,10 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget,
|
|||||||
// wxPrintf( wxT("active: %s\n"), win->GetTitle().c_str() );
|
// wxPrintf( wxT("active: %s\n"), win->GetTitle().c_str() );
|
||||||
|
|
||||||
// MR: wxRequestUserAttention related block
|
// MR: wxRequestUserAttention related block
|
||||||
//BCI: switch(win->m_urgency_hint)
|
switch( win->m_urgency_hint )
|
||||||
switch( GPOINTER_TO_INT(gtk_object_get_data( GTK_OBJECT(widget), "m_urgency_hint") ) )
|
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
//BCI:
|
gtk_timeout_remove( win->m_urgency_hint );
|
||||||
gtk_timeout_remove( GPOINTER_TO_INT(gtk_object_get_data( GTK_OBJECT(widget), "m_urgency_hint") ) );
|
|
||||||
// no break, fallthrough to remove hint too
|
// no break, fallthrough to remove hint too
|
||||||
case -1:
|
case -1:
|
||||||
#if defined(__WXGTK20__) && GTK_CHECK_VERSION(2,7,0)
|
#if defined(__WXGTK20__) && GTK_CHECK_VERSION(2,7,0)
|
||||||
@@ -169,8 +166,7 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget,
|
|||||||
wxgtk_window_set_urgency_hint(GTK_WINDOW( widget ), FALSE);
|
wxgtk_window_set_urgency_hint(GTK_WINDOW( widget ), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//BCI: win->m_urgency_hint = -2;
|
win->m_urgency_hint = -2;
|
||||||
gtk_object_set_data( GTK_OBJECT(widget), "m_urgency_hint", GINT_TO_POINTER(-2) );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -2: break;
|
case -2: break;
|
||||||
@@ -487,12 +483,7 @@ void wxTopLevelWindowGTK::Init()
|
|||||||
m_gdkDecor = m_gdkFunc = 0;
|
m_gdkDecor = m_gdkFunc = 0;
|
||||||
m_grabbed = false;
|
m_grabbed = false;
|
||||||
|
|
||||||
//BCI: header wx/gtk/toplevel.h:
|
m_urgency_hint = -2;
|
||||||
// private gtk_timeout_add result for mimicing wxUSER_ATTENTION_INFO and
|
|
||||||
// wxUSER_ATTENTION_ERROR difference, -2 for no hint, -1 for ERROR hint, rest for GtkTimeout handle.
|
|
||||||
// int m_urgency_hint;
|
|
||||||
|
|
||||||
//BCI: m_urgency_hint = -2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTopLevelWindowGTK::Create( wxWindow *parent,
|
bool wxTopLevelWindowGTK::Create( wxWindow *parent,
|
||||||
@@ -566,9 +557,6 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// BCI:
|
|
||||||
gtk_object_set_data( GTK_OBJECT(m_widget), "m_urgency_hint", GINT_TO_POINTER(-2) );
|
|
||||||
|
|
||||||
wxWindow *topParent = wxGetTopLevelParent(m_parent);
|
wxWindow *topParent = wxGetTopLevelParent(m_parent);
|
||||||
if (topParent && (((GTK_IS_WINDOW(topParent->m_widget)) &&
|
if (topParent && (((GTK_IS_WINDOW(topParent->m_widget)) &&
|
||||||
(GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)) ||
|
(GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)) ||
|
||||||
@@ -1349,17 +1337,10 @@ void wxTopLevelWindowGTK::RequestUserAttention(int flags)
|
|||||||
// wxYieldIfNeeded ensures the processing of it, but can have unwanted side effects - MR
|
// wxYieldIfNeeded ensures the processing of it, but can have unwanted side effects - MR
|
||||||
::wxYieldIfNeeded();
|
::wxYieldIfNeeded();
|
||||||
|
|
||||||
/*BCI:
|
|
||||||
if(m_urgency_hint >= 0)
|
if(m_urgency_hint >= 0)
|
||||||
gtk_timeout_remove(m_urgency_hint);
|
gtk_timeout_remove(m_urgency_hint);
|
||||||
*/
|
|
||||||
int urgency_hint = GPOINTER_TO_INT( gtk_object_get_data( GTK_OBJECT(m_widget), "m_urgency_hint") );
|
|
||||||
if(urgency_hint >= 0)
|
|
||||||
gtk_timeout_remove(urgency_hint);
|
|
||||||
//BCI: END
|
|
||||||
|
|
||||||
//BCI: m_urgency_hint = -2;
|
m_urgency_hint = -2;
|
||||||
gtk_object_set_data( GTK_OBJECT(m_widget), "m_urgency_hint", GINT_TO_POINTER(-2));
|
|
||||||
|
|
||||||
if( GTK_WIDGET_REALIZED(m_widget) && !IsActive() )
|
if( GTK_WIDGET_REALIZED(m_widget) && !IsActive() )
|
||||||
{
|
{
|
||||||
@@ -1367,14 +1348,9 @@ void wxTopLevelWindowGTK::RequestUserAttention(int flags)
|
|||||||
|
|
||||||
if (flags & wxUSER_ATTENTION_INFO)
|
if (flags & wxUSER_ATTENTION_INFO)
|
||||||
{
|
{
|
||||||
//BCI: m_urgency_hint = gtk_timeout_add(5000, (GtkFunction)gtk_frame_urgency_timer_callback, this);
|
m_urgency_hint = gtk_timeout_add(5000, (GtkFunction)gtk_frame_urgency_timer_callback, this);
|
||||||
gtk_object_set_data( GTK_OBJECT(m_widget), "m_urgency_hint",
|
|
||||||
GINT_TO_POINTER( gtk_timeout_add(5000,
|
|
||||||
(GtkFunction)gtk_frame_urgency_timer_callback,
|
|
||||||
m_widget) ) );
|
|
||||||
} else {
|
} else {
|
||||||
//BCI: m_urgency_hint = -1;
|
m_urgency_hint = -1;
|
||||||
gtk_object_set_data( GTK_OBJECT(m_widget), "m_urgency_hint", GINT_TO_POINTER(-1) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -105,17 +105,16 @@ static void wxgtk_window_set_urgency_hint (GtkWindow *win,
|
|||||||
XFree(wm_hints);
|
XFree(wm_hints);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint gtk_frame_urgency_timer_callback( GtkWidget *win )
|
static gint gtk_frame_urgency_timer_callback( wxTopLevelWindowGTK *win )
|
||||||
{
|
{
|
||||||
#if defined(__WXGTK20__) && GTK_CHECK_VERSION(2,7,0)
|
#if defined(__WXGTK20__) && GTK_CHECK_VERSION(2,7,0)
|
||||||
if(!gtk_check_version(2,7,0))
|
if(!gtk_check_version(2,7,0))
|
||||||
gtk_window_set_urgency_hint(GTK_WINDOW( win ), FALSE);
|
gtk_window_set_urgency_hint(GTK_WINDOW( win->m_widget ), FALSE);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
wxgtk_window_set_urgency_hint(GTK_WINDOW( win ), FALSE);
|
wxgtk_window_set_urgency_hint(GTK_WINDOW( win->m_widget ), FALSE);
|
||||||
|
|
||||||
//BCI: argument from GtkWidget* to wxTopLevelWindowGTK* && win->m_urgency_hint = -2;
|
win->m_urgency_hint = -2;
|
||||||
gtk_object_set_data(GTK_OBJECT(win), "m_urgency_hint", GINT_TO_POINTER(-2));
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,12 +151,10 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget,
|
|||||||
// wxPrintf( wxT("active: %s\n"), win->GetTitle().c_str() );
|
// wxPrintf( wxT("active: %s\n"), win->GetTitle().c_str() );
|
||||||
|
|
||||||
// MR: wxRequestUserAttention related block
|
// MR: wxRequestUserAttention related block
|
||||||
//BCI: switch(win->m_urgency_hint)
|
switch( win->m_urgency_hint )
|
||||||
switch( GPOINTER_TO_INT(gtk_object_get_data( GTK_OBJECT(widget), "m_urgency_hint") ) )
|
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
//BCI:
|
gtk_timeout_remove( win->m_urgency_hint );
|
||||||
gtk_timeout_remove( GPOINTER_TO_INT(gtk_object_get_data( GTK_OBJECT(widget), "m_urgency_hint") ) );
|
|
||||||
// no break, fallthrough to remove hint too
|
// no break, fallthrough to remove hint too
|
||||||
case -1:
|
case -1:
|
||||||
#if defined(__WXGTK20__) && GTK_CHECK_VERSION(2,7,0)
|
#if defined(__WXGTK20__) && GTK_CHECK_VERSION(2,7,0)
|
||||||
@@ -169,8 +166,7 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget,
|
|||||||
wxgtk_window_set_urgency_hint(GTK_WINDOW( widget ), FALSE);
|
wxgtk_window_set_urgency_hint(GTK_WINDOW( widget ), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//BCI: win->m_urgency_hint = -2;
|
win->m_urgency_hint = -2;
|
||||||
gtk_object_set_data( GTK_OBJECT(widget), "m_urgency_hint", GINT_TO_POINTER(-2) );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -2: break;
|
case -2: break;
|
||||||
@@ -487,12 +483,7 @@ void wxTopLevelWindowGTK::Init()
|
|||||||
m_gdkDecor = m_gdkFunc = 0;
|
m_gdkDecor = m_gdkFunc = 0;
|
||||||
m_grabbed = false;
|
m_grabbed = false;
|
||||||
|
|
||||||
//BCI: header wx/gtk/toplevel.h:
|
m_urgency_hint = -2;
|
||||||
// private gtk_timeout_add result for mimicing wxUSER_ATTENTION_INFO and
|
|
||||||
// wxUSER_ATTENTION_ERROR difference, -2 for no hint, -1 for ERROR hint, rest for GtkTimeout handle.
|
|
||||||
// int m_urgency_hint;
|
|
||||||
|
|
||||||
//BCI: m_urgency_hint = -2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTopLevelWindowGTK::Create( wxWindow *parent,
|
bool wxTopLevelWindowGTK::Create( wxWindow *parent,
|
||||||
@@ -566,9 +557,6 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// BCI:
|
|
||||||
gtk_object_set_data( GTK_OBJECT(m_widget), "m_urgency_hint", GINT_TO_POINTER(-2) );
|
|
||||||
|
|
||||||
wxWindow *topParent = wxGetTopLevelParent(m_parent);
|
wxWindow *topParent = wxGetTopLevelParent(m_parent);
|
||||||
if (topParent && (((GTK_IS_WINDOW(topParent->m_widget)) &&
|
if (topParent && (((GTK_IS_WINDOW(topParent->m_widget)) &&
|
||||||
(GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)) ||
|
(GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)) ||
|
||||||
@@ -1349,17 +1337,10 @@ void wxTopLevelWindowGTK::RequestUserAttention(int flags)
|
|||||||
// wxYieldIfNeeded ensures the processing of it, but can have unwanted side effects - MR
|
// wxYieldIfNeeded ensures the processing of it, but can have unwanted side effects - MR
|
||||||
::wxYieldIfNeeded();
|
::wxYieldIfNeeded();
|
||||||
|
|
||||||
/*BCI:
|
|
||||||
if(m_urgency_hint >= 0)
|
if(m_urgency_hint >= 0)
|
||||||
gtk_timeout_remove(m_urgency_hint);
|
gtk_timeout_remove(m_urgency_hint);
|
||||||
*/
|
|
||||||
int urgency_hint = GPOINTER_TO_INT( gtk_object_get_data( GTK_OBJECT(m_widget), "m_urgency_hint") );
|
|
||||||
if(urgency_hint >= 0)
|
|
||||||
gtk_timeout_remove(urgency_hint);
|
|
||||||
//BCI: END
|
|
||||||
|
|
||||||
//BCI: m_urgency_hint = -2;
|
m_urgency_hint = -2;
|
||||||
gtk_object_set_data( GTK_OBJECT(m_widget), "m_urgency_hint", GINT_TO_POINTER(-2));
|
|
||||||
|
|
||||||
if( GTK_WIDGET_REALIZED(m_widget) && !IsActive() )
|
if( GTK_WIDGET_REALIZED(m_widget) && !IsActive() )
|
||||||
{
|
{
|
||||||
@@ -1367,14 +1348,9 @@ void wxTopLevelWindowGTK::RequestUserAttention(int flags)
|
|||||||
|
|
||||||
if (flags & wxUSER_ATTENTION_INFO)
|
if (flags & wxUSER_ATTENTION_INFO)
|
||||||
{
|
{
|
||||||
//BCI: m_urgency_hint = gtk_timeout_add(5000, (GtkFunction)gtk_frame_urgency_timer_callback, this);
|
m_urgency_hint = gtk_timeout_add(5000, (GtkFunction)gtk_frame_urgency_timer_callback, this);
|
||||||
gtk_object_set_data( GTK_OBJECT(m_widget), "m_urgency_hint",
|
|
||||||
GINT_TO_POINTER( gtk_timeout_add(5000,
|
|
||||||
(GtkFunction)gtk_frame_urgency_timer_callback,
|
|
||||||
m_widget) ) );
|
|
||||||
} else {
|
} else {
|
||||||
//BCI: m_urgency_hint = -1;
|
m_urgency_hint = -1;
|
||||||
gtk_object_set_data( GTK_OBJECT(m_widget), "m_urgency_hint", GINT_TO_POINTER(-1) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user