From 9650d2f43a24ff056fed89f5a23d3fe574503bb2 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 2 Jul 2006 21:53:14 +0000 Subject: [PATCH] set frame title using _NET_WM_NAME and _NET_WM_ICON_NAME svn: r3576 --- src/wxxt/src/Windows/Frame.cc | 2 +- src/wxxt/src/Windows/Window.cc | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/wxxt/src/Windows/Frame.cc b/src/wxxt/src/Windows/Frame.cc index 0bff04c61e..11fdbae1aa 100644 --- a/src/wxxt/src/Windows/Frame.cc +++ b/src/wxxt/src/Windows/Frame.cc @@ -227,7 +227,6 @@ Bool wxFrame::Create(wxFrame *frame_parent, char *title, } // set common data SetSize(x, y, width, height, wxSIZE_AUTO | wxPOS_USE_MINUS_ONE); - SetTitle(title); // create board widget wgt = XtVaCreateManagedWidget( name, xfwfBoardWidgetClass, X->frame, @@ -238,6 +237,7 @@ Bool wxFrame::Create(wxFrame *frame_parent, char *title, AddEventHandlers(); XtRealizeWidget(X->frame); + SetTitle(title); // make a WM_PROTOCOLS atom if necessary XInternAtom(XtDisplay(X->frame), "WM_PROTOCOLS", False); // make a WM_DELETE_WINDOW atom diff --git a/src/wxxt/src/Windows/Window.cc b/src/wxxt/src/Windows/Window.cc index 6920291f5b..88891b6c4f 100644 --- a/src/wxxt/src/Windows/Window.cc +++ b/src/wxxt/src/Windows/Window.cc @@ -55,7 +55,7 @@ # include #endif -static Atom utf8_atom = 0; +static Atom utf8_atom = 0, net_wm_name_atom, net_wm_icon_name_atom; extern void wxSetSensitive(Widget, Bool enabled); @@ -243,19 +243,36 @@ void wxWindow::SetName(char *name) void wxWindow::SetTitle(char *title) { + /* Note: widget must be realized */ + if (!X->frame) // forbid, if no widget associated return; if (!utf8_atom) { utf8_atom = XInternAtom(XtDisplay(X->frame), "UTF8_STRING", FALSE); + net_wm_name_atom = XInternAtom(XtDisplay(X->frame), "_NET_WM_NAME", FALSE); + net_wm_icon_name_atom = XInternAtom(XtDisplay(X->frame), "_NET_WM_ICON_NAME", FALSE); } +#if 0 XtVaSetValues(X->frame, XtNtitle, title, XtNiconName, title, XtNtitleEncoding, utf8_atom, XtNiconNameEncoding, utf8_atom, NULL); +#endif + + { + int i; + for (i = 0; i < 2; i++) { + XChangeProperty(XtDisplay(X->frame), XtWindow(X->frame), + !i ? net_wm_name_atom: net_wm_icon_name_atom, + utf8_atom, + 8, PropModeReplace, + (unsigned char *)title, strlen(title)); + } + } } //-----------------------------------------------------------------------------