将VkMainWindow保持在底部

时间:2018-07-26 18:08:26

标签: c++ linux kde motif

我有一个在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);
}

1 个答案:

答案 0 :(得分:0)

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