Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/base/inc/TVirtualX.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
11 changes: 11 additions & 0 deletions core/base/src/TVirtualX.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
1 change: 1 addition & 0 deletions graf2d/x11/inc/TGX11.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
21 changes: 21 additions & 0 deletions graf2d/x11/src/GX11Gui.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
1 change: 1 addition & 0 deletions gui/ged/src/TGedPatternSelect.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions gui/gui/src/TGColorSelect.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
1 change: 1 addition & 0 deletions gui/gui/src/TGComboBox.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions gui/gui/src/TGMenu.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 4 additions & 0 deletions gui/gui/src/TGToolTip.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Loading