ShowFullScreen in MWM Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
User avatar
Dawix
In need of some credit
In need of some credit
Posts: 7
Joined: Wed Jul 26, 2017 3:28 pm
Location: Lombardy, Italy
Contact:

ShowFullScreen in MWM

Post by Dawix »

I'm working with wxWidgets 3.0.3 on a xplatform project. I report a problem encountered when I executed an homemade helloworld program in MWM (CentOS 7 both 32 and 64 bit). When wxTopLevelWindow::ShowFullScreen is called, a segmentation fault happened. Using gdb on the related core dump I found that it seems due to a GDK_WINDOW_XID crash when a NULL GdkWindow* is passed to it (lines 1049-1050, file /wxWidgets-3.0.3/src/gtk/toplevel.cpp). This NULL GdkWindow* is coming from gtk_widget_get_window.
The segmentation fault is present only in MWM and not, as an example, in GNOME (CentOS7, 64bit). Moreover, everything is good also under MS Windows 10 (64bit). Finally, I solved the problem using:

Code: Select all

wxFrame* m_controlwindow = new wxFrame(NULL, -1, "Main Control Window");
m_controlwindow->Show(); 
m_controlwindow->ShowFullScreen(true, wxFULLSCREEN_ALL);
i.e. Show before ShowFullScreen.
Is this the only way to solve this problem?
Thanks in advance!
Dawix
Last edited by Dawix on Fri Jul 28, 2017 1:26 pm, edited 3 times in total.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7478
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: ShowFullScreen in MWM

Post by ONEEYEMAN »

Hi,
What is the complete backtrace at the time of the crash?
Are you using a GPE, which is based on the X server or something else?

Is minimal sample and display sample works OK?

Did you modify the wxWidgets code in any way in addition to the "Hello World"?

How did you compile the library - i.e. what options did you submit to configure?

Thank you.
User avatar
Dawix
In need of some credit
In need of some credit
Posts: 7
Joined: Wed Jul 26, 2017 3:28 pm
Location: Lombardy, Italy
Contact:

Re: ShowFullScreen in MWM

Post by Dawix »

Hi ONEEYEMAN,
What is the complete backtrace at the time of the crash?
The complete backtrace is:

Code: Select all

#0  0x00007f0a4e69d722 in _gdk_window_has_impl () at /lib64/libgdk-3.so.0
#1  0x00007f0a4e6cbabe in gdk_x11_window_get_xid () at /lib64/libgdk-3.so.0
#2  0x000000000043b539 in wxTopLevelWindowGTK::ShowFullScreen(bool, long) (this=0x2608000, show=true) at ../src/gtk/toplevel.cpp:913
#3  0x0000000000453266 in wxFrame::ShowFullScreen(bool, long) (this=0x2608000, show=true, style=31) at ../src/gtk/frame.cpp:191
Are you using a GPE, which is based on the X server or something else?
No, I'm using a laptop (HP Pavilion dv6) with CentOS7 minimal 64bit + MWM.
Is minimal sample and display sample works OK?
The minimal sample is perfect. The display sample works good (it detects correctly the screen resolution) except that the full screen utility. In this case the application doesn't fit well.
Did you modify the wxWidgets code in any way in addition to the "Hello World"?
No I didn't. My Hello World code is:

Code: Select all

#include <iostream>
#include <wx/wx.h>
using namespace std;

class MyApp : public wxApp
{
public:
	bool OnInit() override;
};

bool MyApp::OnInit()
{
	wxFrame* m_controlwindow = new wxFrame(NULL, -1, "Main Frame");
//	m_controlwindow->Show();
	m_controlwindow->ShowFullScreen(true, wxFULLSCREEN_ALL);
	return true;
}

int main(int argc, char*argv[]) {

	wxApp::SetInstance(new MyApp());
	wxEntryStart(argc, argv);

	wxTheApp->OnInit();
	wxTheApp->OnRun();
	wxTheApp->OnExit();
	wxEntryCleanup();

	return 0;
}
How did you compile the library - i.e. what options did you submit to configure?
I compiled the library as --enable-unicode --enable-debug --disable-shared .
Thank you.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7478
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: ShowFullScreen in MWM

Post by ONEEYEMAN »

Hi,
Did the display sample crashed when switched to the "full screen mode"?

If not - what did you do differently?

Thank you.
User avatar
Dawix
In need of some credit
In need of some credit
Posts: 7
Joined: Wed Jul 26, 2017 3:28 pm
Location: Lombardy, Italy
Contact:

Re: ShowFullScreen in MWM

Post by Dawix »

Hi,
I have no crashes but only screen-fit problem. I post here the difference between the display program full screen output in my machines:

Windows 10 64 bit | Physical Machine | everything is good!
win10_full.jpg
win10_full.jpg (63.84 KiB) Viewed 2439 times
GNOME on CentOS 7 64 bit | Virtual Machine | everything is good again!
gnome_full.jpg
gnome_full.jpg (64.75 KiB) Viewed 2439 times
MWM on CentOS 7 64 bit | Both Physical and Virtual Machine | full screen display doesn't fit the screen dimensions (it is not a really full screen given that borders and title bar are showed :o ).
mwm_full.jpg
mwm_full.jpg (41.48 KiB) Viewed 2439 times
I could suppose that wxWidgets is not able to find a real "main window" in MWM or something like that :? ...
Thanks
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: ShowFullScreen in MWM

Post by doublemax »

Do you need to be able to switch between windowed mode and fullscreen at runtime? If not, try creating the frame without decorations in the first place.
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7478
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: ShowFullScreen in MWM

Post by ONEEYEMAN »

Hi,
Also, just curious - is there a different GTK+ version between GNOME amd MWM machines? Especially for a VM with MWM one.

Thank you.
User avatar
Dawix
In need of some credit
In need of some credit
Posts: 7
Joined: Wed Jul 26, 2017 3:28 pm
Location: Lombardy, Italy
Contact:

Re: ShowFullScreen in MWM

Post by Dawix »

to doublemax:
Do you need to be able to switch between windowed mode and fullscreen at runtime? If not, try creating the frame without decorations in the first place.
Until now I don't need to switch between windowed and full screen mode run-time. I tried your solution and seems to work better than mine. As an example, the simple code here reported provides a good result on MWM (both VM and not-VM):

Code: Select all

bool GuiCtrl::OnInit()
{
	m_controlwindow = new wxFrame(NULL, -1, "Driver Control Panel", wxDefaultPosition,wxSize(wxSystemSettings::GetMetric(wxSYS_SCREEN_X), wxSystemSettings::GetMetric(wxSYS_SCREEN_Y)), wxSIMPLE_BORDER);
	m_controlwindow->Show();
	
	m_controlpanel = new wxPanel(m_controlwindow, wxID_ANY, wxDefaultPosition, wxSize(m_controlwindow->GetClientSize().GetWidth()-30, m_controlwindow->GetClientSize().GetHeight()-30));
	m_controlpanel->SetBackgroundColour(wxColour(*wxRED));
	m_controlpanel->CenterOnParent(wxBOTH);

	m_quitbutton = new wxButton(m_controlpanel, wxID_EXIT);
	m_quitbutton->Bind(wxEVT_BUTTON, &GuiCtrl::onQuit, this);
	m_quitbutton->CenterOnParent(wxBOTH);

	return true;
}
mwm_solved.jpg
mwm_solved.jpg (23.67 KiB) Viewed 2423 times
to ONEEYEMAN:
is there a different GTK+ version between GNOME amd MWM machines? Especially for a VM with MWM one.
The Virtual Machine with both GNOME and MWM installed have both GTK2+ (2.24.28) and GTK3+ (3.14.13) installed. wxWidgets use GTK3+.
The Physical Machine with MWM installed have GTK3+ (3.14.13) installed.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7478
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: ShowFullScreen in MWM

Post by ONEEYEMAN »

Hi,
Does GNOME and MWM uses different themes?

Thank you.
User avatar
Dawix
In need of some credit
In need of some credit
Posts: 7
Joined: Wed Jul 26, 2017 3:28 pm
Location: Lombardy, Italy
Contact:

Re: ShowFullScreen in MWM

Post by Dawix »

GNOME uses the adwaita theme meanwhile MWM uses the default resources (no user .Xdefaults settings applied).
Post Reply