diff --git a/core/base/inc/TVirtualX.h b/core/base/inc/TVirtualX.h index de2c1b3c5c99b..238efa6accc20 100644 --- a/core/base/inc/TVirtualX.h +++ b/core/base/inc/TVirtualX.h @@ -50,6 +50,7 @@ class TVirtualX : public TNamed, public TAttLine, public TAttFill, public TAttTe enum EBoxMode { kHollow, kFilled }; enum ETextMode { kClear, kOpaque }; enum ETextSetMode { kCheck, kLoad }; + enum EWindowHint { kHintCombo, kHintPopup, kHintTooltip }; protected: EDrawMode fDrawMode; //Drawing mode @@ -257,6 +258,7 @@ class TVirtualX : public TNamed, public TAttLine, public TAttFill, public TAttTe virtual void ChangeWindowAttributes(Window_t id, SetWindowAttributes_t *attr); virtual void ChangeProperty(Window_t id, Atom_t property, Atom_t type, UChar_t *data, Int_t len); + virtual void SetWindowHint(Window_t id, EWindowHint hint); virtual void DrawLine(Drawable_t id, GContext_t gc, Int_t x1, Int_t y1, Int_t x2, Int_t y2); virtual void ClearArea(Window_t id, Int_t x, Int_t y, UInt_t w, UInt_t h); virtual Bool_t CheckEvent(Window_t id, EGEventType type, Event_t &ev); diff --git a/core/base/src/TVirtualX.cxx b/core/base/src/TVirtualX.cxx index f4e05e3f07b5f..7288927a286cc 100644 --- a/core/base/src/TVirtualX.cxx +++ b/core/base/src/TVirtualX.cxx @@ -1750,6 +1750,17 @@ void TVirtualX::ChangeProperty(Window_t /*id*/, Atom_t /*property*/, { } +//////////////////////////////////////////////////////////////////////////////// +/// Alters the property for the specified window and causes the X server +/// to generate a PropertyNotify event on that window. +/// +/// \param [in] id the window whose property you want to change +/// \param [in] hint specifies the type to be changed + +void TVirtualX::SetWindowHint(Window_t /*id*/, EWindowHint /*hint*/) +{ +} + //////////////////////////////////////////////////////////////////////////////// /// Uses the components of the specified GC to draw a line between the /// specified set of points (x1, y1) and (x2, y2). diff --git a/graf2d/x11/inc/TGX11.h b/graf2d/x11/inc/TGX11.h index 4646efa97d19e..9bead303a53a9 100644 --- a/graf2d/x11/inc/TGX11.h +++ b/graf2d/x11/inc/TGX11.h @@ -317,6 +317,7 @@ friend struct XWindow_t; void ChangeWindowAttributes(Window_t id, SetWindowAttributes_t *attr) override; void ChangeProperty(Window_t id, Atom_t property, Atom_t type, UChar_t *data, Int_t len) override; + void SetWindowHint(Window_t id, EWindowHint hint) override; void DrawLine(Drawable_t id, GContext_t gc, Int_t x1, Int_t y1, Int_t x2, Int_t y2) override; void ClearArea(Window_t id, Int_t x, Int_t y, UInt_t w, UInt_t h) override; Bool_t CheckEvent(Window_t id, EGEventType type, Event_t &ev) override; diff --git a/graf2d/x11/src/GX11Gui.cxx b/graf2d/x11/src/GX11Gui.cxx index 61fab06f1f8d1..a5b6d33642d30 100644 --- a/graf2d/x11/src/GX11Gui.cxx +++ b/graf2d/x11/src/GX11Gui.cxx @@ -1725,6 +1725,27 @@ void TGX11::ChangeProperty(Window_t id, Atom_t property, Atom_t type, 8, PropModeReplace, data, len); } +//////////////////////////////////////////////////////////////////////////////// +/// This function alters the property for the specified window and +/// causes the X server to generate a PropertyNotify event on that +/// window. Specifically for WSL (Windows Subsytem for Linux) + +void TGX11::SetWindowHint(Window_t id, EWindowHint hint) +{ + if (!id) + return; + static const char *property_names[] = { + "_NET_WM_WINDOW_TYPE_COMBO", + "_NET_WM_WINDOW_TYPE_POPUP_MENU", + "_NET_WM_WINDOW_TYPE_TOOLTIP" + }; + const char *property_name = property_names[hint]; + Atom_t property_type = gVirtualX->InternAtom("_NET_WM_WINDOW_TYPE", kFALSE); + Atom_t property_value = gVirtualX->InternAtom(property_name, kFALSE); + XChangeProperty((Display*)fDisplay, (Window) id, (Atom) property_type, + (Atom) XA_ATOM, 32, PropModeReplace, (UChar_t*)&property_value, 1); +} + //////////////////////////////////////////////////////////////////////////////// /// Draw a line. diff --git a/gui/ged/src/TGedPatternSelect.cxx b/gui/ged/src/TGedPatternSelect.cxx index 7abc6c8da3bc5..6a7761d717d8a 100644 --- a/gui/ged/src/TGedPatternSelect.cxx +++ b/gui/ged/src/TGedPatternSelect.cxx @@ -312,6 +312,7 @@ TGedPopup::TGedPopup(const TGWindow *p, const TGWindow *m, UInt_t w, UInt_t h, wattr.fOverrideRedirect = kTRUE; wattr.fSaveUnder = kTRUE; gVirtualX->ChangeWindowAttributes(fId, &wattr); + gVirtualX->SetWindowHint(fId, TVirtualX::kHintTooltip); AddInput(kStructureNotifyMask); } diff --git a/gui/gui/src/TGColorSelect.cxx b/gui/gui/src/TGColorSelect.cxx index 9599c4fb562e8..a708aeb1d871e 100644 --- a/gui/gui/src/TGColorSelect.cxx +++ b/gui/gui/src/TGColorSelect.cxx @@ -227,6 +227,7 @@ TGColorPopup::TGColorPopup(const TGWindow *p, const TGWindow *m, Pixel_t color) wattr.fOverrideRedirect = kTRUE; //wattr.fSaveUnder = kTRUE; gVirtualX->ChangeWindowAttributes(fId, &wattr); + gVirtualX->SetWindowHint(fId, TVirtualX::kHintTooltip); AddInput(kStructureNotifyMask); diff --git a/gui/gui/src/TGComboBox.cxx b/gui/gui/src/TGComboBox.cxx index 35ccc3a09f735..dd06909fc70cd 100644 --- a/gui/gui/src/TGComboBox.cxx +++ b/gui/gui/src/TGComboBox.cxx @@ -74,6 +74,7 @@ TGComboBoxPopup::TGComboBoxPopup(const TGWindow *p, UInt_t w, UInt_t h, wattr.fBorderPixel = fgBlackPixel; wattr.fBorderWidth = 1; gVirtualX->ChangeWindowAttributes(fId, &wattr); + gVirtualX->SetWindowHint(fId, TVirtualX::kHintCombo); AddInput(kStructureNotifyMask); fEditDisabled = kEditDisable | kEditDisableGrab | kEditDisableBtnEnable; diff --git a/gui/gui/src/TGMenu.cxx b/gui/gui/src/TGMenu.cxx index b97a2a31e3834..bf55f92d07eaa 100644 --- a/gui/gui/src/TGMenu.cxx +++ b/gui/gui/src/TGMenu.cxx @@ -961,6 +961,7 @@ TGPopupMenu::TGPopupMenu(const TGWindow *p, UInt_t w, UInt_t h, UInt_t options) wattr.fSaveUnder = kTRUE; gVirtualX->ChangeWindowAttributes(fId, &wattr); + gVirtualX->SetWindowHint(fId, TVirtualX::kHintPopup); AddInput(kPointerMotionMask | kEnterWindowMask | kLeaveWindowMask); } diff --git a/gui/gui/src/TGToolTip.cxx b/gui/gui/src/TGToolTip.cxx index e967d2677eb0a..caae2b87abc00 100644 --- a/gui/gui/src/TGToolTip.cxx +++ b/gui/gui/src/TGToolTip.cxx @@ -87,6 +87,7 @@ TGToolTip::TGToolTip(const TGWindow *p, const TGFrame *f, const char *text, attr.fSaveUnder = kTRUE; gVirtualX->ChangeWindowAttributes(fId, &attr); + gVirtualX->SetWindowHint(fId, TVirtualX::kHintTooltip); SetBackgroundColor(fClient->GetResourcePool()->GetTipBgndColor()); fLabel = new TGLabel(this, text); @@ -122,6 +123,7 @@ TGToolTip::TGToolTip(const TGWindow *p, const TBox *box, const char *text, attr.fSaveUnder = kTRUE; gVirtualX->ChangeWindowAttributes(fId, &attr); + gVirtualX->SetWindowHint(fId, TVirtualX::kHintTooltip); SetBackgroundColor(fClient->GetResourcePool()->GetTipBgndColor()); fLabel = new TGLabel(this, text); @@ -155,6 +157,7 @@ TGToolTip::TGToolTip(const TBox *box, const char *text,Long_t delayms) attr.fSaveUnder = kTRUE; gVirtualX->ChangeWindowAttributes(fId, &attr); + gVirtualX->SetWindowHint(fId, TVirtualX::kHintTooltip); SetBackgroundColor(fClient->GetResourcePool()->GetTipBgndColor()); fLabel = new TGLabel(this, text); @@ -186,6 +189,7 @@ TGToolTip::TGToolTip(Int_t x, Int_t y, const char *text, Long_t delayms) attr.fSaveUnder = kTRUE; gVirtualX->ChangeWindowAttributes(fId, &attr); + gVirtualX->SetWindowHint(fId, TVirtualX::kHintTooltip); SetBackgroundColor(fClient->GetResourcePool()->GetTipBgndColor()); fLabel = new TGLabel(this, text);