Skip to content

Commit

Permalink
Traktor: Some fixes for DialogX11 and ToolFormX11 hints.
Browse files Browse the repository at this point in the history
  • Loading branch information
apistol78 committed Nov 6, 2023
1 parent 0f74847 commit 21e91f0
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 13 deletions.
14 changes: 10 additions & 4 deletions code/Ui/X11/DialogX11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,25 @@ bool DialogX11::create(IWidget* parent, const std::wstring& text, int width, int
if ((style & (WsSystemBox | WsMinimizeBox | WsCloseBox | WsCaption)) == 0)
{
Atom type = XInternAtom(m_context->getDisplay(),"_NET_WM_WINDOW_TYPE", False);
Atom value = XInternAtom(m_context->getDisplay(),"_NET_WM_WINDOW_TYPE_DOCK", False);
XChangeProperty(m_context->getDisplay(), window, type, XA_ATOM, 32, PropModeReplace, reinterpret_cast<unsigned char*>(&value), 1);
Atom value = XInternAtom(m_context->getDisplay(),"_NET_WM_WINDOW_TYPE_DOCK", False);
XChangeProperty(m_context->getDisplay(), window, type, XA_ATOM, 32, PropModeReplace, reinterpret_cast<unsigned char*>(&value), 1);
}
// Else set as dialog type.
else
{
Atom type = XInternAtom(m_context->getDisplay(),"_NET_WM_WINDOW_TYPE", False);
Atom value = XInternAtom(m_context->getDisplay(),"_NET_WM_WINDOW_TYPE_DIALOG", False);
XChangeProperty(m_context->getDisplay(), window, type, XA_ATOM, 32, PropModeReplace, reinterpret_cast<unsigned char*>(&value), 1);
}

// Notify WM about form title.
if ((style & WsCaption) != 0)
{
std::string cs = wstombs(text);
const std::string cs = wstombs(text);
const char* csp = cs.c_str();

XTextProperty tp;
XStringListToTextProperty((char**)&csp, 1, &tp);

XSetWMName(m_context->getDisplay(), window, &tp);
}

Expand Down
34 changes: 26 additions & 8 deletions code/Ui/X11/ToolFormX11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@
#include "Drawing/Image.h"
#include "Drawing/PixelFormat.h"
#include "Drawing/Filters/ScaleFilter.h"
#include "Ui/ToolForm.h"
#include "Ui/Itf/ISystemBitmap.h"
#include "Ui/X11/ToolFormX11.h"

namespace traktor
namespace traktor::ui
{
namespace ui
{

ToolFormX11::ToolFormX11(Context* context, EventSubject* owner)
: WidgetX11Impl< IToolForm >(context, owner)
Expand Down Expand Up @@ -50,9 +49,30 @@ bool ToolFormX11::create(IWidget* parent, const std::wstring& text, int width, i
);

// Change style of window, no WM chrome.
Atom type = XInternAtom(m_context->getDisplay(),"_NET_WM_WINDOW_TYPE", False);
Atom value = XInternAtom(m_context->getDisplay(),"_NET_WM_WINDOW_TYPE_DOCK", False);
XChangeProperty(m_context->getDisplay(), window, type, XA_ATOM, 32, PropModeReplace, reinterpret_cast<unsigned char*>(&value), 1);
if ((style & ToolForm::WsDefault) == 0)
{
Atom type = XInternAtom(m_context->getDisplay(),"_NET_WM_WINDOW_TYPE", False);
Atom value = XInternAtom(m_context->getDisplay(),"_NET_WM_WINDOW_TYPE_DOCK", False);
XChangeProperty(m_context->getDisplay(), window, type, XA_ATOM, 32, PropModeReplace, reinterpret_cast<unsigned char*>(&value), 1);
}
// Else set as dialog type.
else
{
Atom type = XInternAtom(m_context->getDisplay(),"_NET_WM_WINDOW_TYPE", False);
Atom value = XInternAtom(m_context->getDisplay(),"_NET_WM_WINDOW_TYPE_DIALOG", False);
XChangeProperty(m_context->getDisplay(), window, type, XA_ATOM, 32, PropModeReplace, reinterpret_cast<unsigned char*>(&value), 1);
}

// Notify WM about form title.
if ((style & WsCaption) != 0)
{
const std::string cs = wstombs(text);
const char* csp = cs.c_str();

XTextProperty tp;
XStringListToTextProperty((char**)&csp, 1, &tp);
XSetWMName(m_context->getDisplay(), window, &tp);
}

// Make tool form on top of parent.
if (parent != nullptr)
Expand Down Expand Up @@ -146,6 +166,4 @@ void ToolFormX11::endModal(DialogResult result)
m_modal = false;
}

}
}

2 changes: 1 addition & 1 deletion code/Ui/X11/WidgetX11Impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ class WidgetX11Impl
switch (cursor)
{
default:
case Cursor::None:
// case Cursor::None:
case Cursor::Arrow:
break;
case Cursor::ArrowRight:
Expand Down

0 comments on commit 21e91f0

Please sign in to comment.