【问题标题】:Keep VkMainWindow on Bottom将 VkMainWindow 保持在底部
【发布时间】:2019-01-03 19:39:42
【问题描述】:

我有一个在 Linux 上运行的应用程序,它由一个 VkMainWindow 和几个 VkWindows 组成。期望的行为是保持 VkMainWindow 总是在底部(因此,所有的 VkWindows 总是在 VkMainWindow 的顶部)。现有代码的工作方式与 KDE 上宣传的一样,但客户决定它需要在 MWM 下运行。在 MWM 下运行,VkMainWindow 高于 VkWindows。有什么想法吗?

VkMainWindow:

 MainWindow::MainWindow(MyContainer const &container, ArgList args, Cardinal argc)  
       :  
            BaseWindow("My Base Window", args, argc,  
            _statusWindow(new StatusWindow(container)),  
            m_helpDialog(new MainHelpDialog),  
            m_container(container),  
            m_frame(nullptr),  
            m_form(nullptr),  
            _button1(nullptr),  
            _widget1(nullptr),  
            m_button2(nullptr),  
            m_widget2(nullptr),  
            m_button2(nullptr),  
            m_widget3(nullptr),  
            m_button3(nullptr),    
            m_button4(nullptr),  
            m_button5(nullptr),  
            m_widget4(nullptr),  
            _label1(nullptr),  
            _label2(nullptr),  
            _label3(nullptr),  
            _label4(nullptr),  
            _label5(nullptr),  
            _label6(nullptr),  
            _label7(nullptr)  
{  
   Display *mainDisplay;  
   mainDisplay = XOpenDisplay(0);  
   if (mainDisplay)  
   {  
        m_width = m_mainWindowWidth = 1280;  
        m_height = m_mainWindowHeight = 1024;  
        XCloseDisplay(mainDisplay);  
   }  

   XtVaSetValues(m_shellWidget, XmNmwmFunctions, MWM_FUNC_MOVE | MWM_FUNC_MINIMIZE, XmNx, 0, XmNy, 0, NULL);  
   m_configFile = currentWorkspace;   
}

VkWindows:

BaseWindow::BaseWindow(string const &name, ArgList args, Cardinal argc,  
       unsigned int createOptions, bool createTabStack, bool removeCornerFunctions, bool scrollable, bool workspaceConfigurable)  
       :  
            VkWindow(name.c_str(), args, argc), _mainForm(0), _mainOffset(   
                  MAIN_OFFSET), _buttonSpacing(BUTTON_SPACING), _createOptions(createOptions),  
            _createTabStack(createTabStack), _statusText(0), m_buttonBoxForm(0), m_helpForm(0),  
            m_okButton(0), m_cancelButton(0), m_applyButton(0), m_applyCb(0), m_okCb(0), m_cancelCb(0),  
            m_screenId(INVALID_SCREEN_ID), m_previousTab(0), _tabStack(0), _tabForm(0), m_initialized(false),  
            m_shellWidget(0), m_clipWindow(0), _isScrollable(scrollable), m_isValid(true), m_statusOnly(false),  
            m_validateOnOk(true), m_validateOnApply(true), m_widgetsMapped(false), m_fooLocked(false), m_isLocked(false),  
            m_currentSize(FULL), m_lastSize(0)  
{   
   Widget parent = mainWindowWidget();  
   XtSetValues(parent, args, argc);    

   m_shellWidget = parent;  
   while (m_shellWidget && !XtIsShell(m_shellWidget))  
   {  
      m_shellWidget = XtParent(m_shellWidget);    
   }  

   if (removeCornerFunctions)  
   {  
       if (m_shellWidget)  
       {
         XtVaSetValues(m_shellWidget,  
         XmNmwmFunctions, 22,  
//         MWM_FUNC_RESIZE | MWM_FUNC_MOVE | MWM_FUNC_MINIMIZE | MWM_FUNC_CLOSE,  
         NULL);  
         XtAddEventHandler(m_shellWidget, StructureNotifyMask, false, resizeCb, this);  
      }  
   }  
   ...  
}

主要:

int main(int argc, char **argv)  
{
   ...  
   Cardinal ac;  
   Arg args[20];  
   std::string title("My Client");

   XrmOptionDescRec *optionList = NULL;  
   int numOptions = 0;  

   app = new VkApp(const_cast<char*>(title.c_str()), &argc, argv, optionList, numOptions);  
   ...  
   app->run();  
   ...  
   return (0);
}

【问题讨论】:

  • “我可以包含显着的代码段落” - 最好是 minimal reproducible example
  • 让我往回走,我可以包含代码。该代码受出口控制,我想对此非常谨慎。
  • 如果没有产生问题的最小示例,您不太可能获得帮助。不要发布您的申请。创建一个小例子。
  • 添加了净化示例。
  • 我仍然没有收到回复。示例代码是否不足?

标签: c++ linux kde motif


【解决方案1】:

解决方法是在主窗口的事件循环中调用 VkWindow:lower()。

【讨论】:

    猜你喜欢
    • 2021-07-15
    • 2016-04-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-23
    • 1970-01-01
    相关资源
    最近更新 更多