parent
0509c211b1
commit
baf094ce92
|
@ -598,6 +598,20 @@
|
|||
<property name="use_underline">True</property>
|
||||
<child>
|
||||
<widget class="GtkMenu" id="VideoMenu_menu">
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="VideoFullscreen">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">gtk-fullscreen</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<accelerator key="F11" signal="activate"/>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkSeparatorMenuItem" id="separatormenuitem1">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkRadioMenuItem" id="VideoOpenGL">
|
||||
<property name="visible">True</property>
|
||||
|
|
|
@ -90,7 +90,8 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
|
|||
m_iJoypadMin (1),
|
||||
m_iJoypadMax (4),
|
||||
m_iVideoOutputMin (OutputCairo),
|
||||
m_iVideoOutputMax (OutputXvideo)
|
||||
m_iVideoOutputMax (OutputXvideo),
|
||||
m_bFullscreen (false)
|
||||
{
|
||||
m_poXml = _poXml;
|
||||
m_poFileOpenDialog = NULL;
|
||||
|
@ -131,6 +132,9 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
|
|||
Gtk::MenuItem * poMI;
|
||||
Gtk::CheckMenuItem * poCMI;
|
||||
|
||||
// Menu bar
|
||||
m_poMenuBar = dynamic_cast<Gtk::MenuBar *>(_poXml->get_widget("MenuBar"));
|
||||
|
||||
// Video output menu
|
||||
//
|
||||
struct
|
||||
|
@ -828,6 +832,11 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
|
|||
poCMI, astAutofire[i].m_eKeyFlag));
|
||||
}
|
||||
|
||||
// Fullscreen menu
|
||||
//
|
||||
poMI = dynamic_cast<Gtk::MenuItem *>(_poXml->get_widget("VideoFullscreen"));
|
||||
poMI->signal_activate().connect(sigc::mem_fun(*this, &Window::vOnVideoFullscreen));
|
||||
|
||||
// GDB menu
|
||||
//
|
||||
poMI = dynamic_cast<Gtk::MenuItem *>(_poXml->get_widget("GdbWait"));
|
||||
|
@ -1953,4 +1962,18 @@ void Window::vUpdateGameSlots()
|
|||
}
|
||||
}
|
||||
|
||||
void Window::vToggleFullscreen()
|
||||
{
|
||||
if(!m_bFullscreen)
|
||||
{
|
||||
fullscreen();
|
||||
m_poMenuBar->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
unfullscreen();
|
||||
m_poMenuBar->show();
|
||||
}
|
||||
}
|
||||
|
||||
} // VBA namespace
|
||||
|
|
|
@ -159,6 +159,7 @@ protected:
|
|||
virtual void vOnFrameskipToggled(Gtk::CheckMenuItem * _poCMI, int _iValue);
|
||||
virtual void vOnThrottleToggled(Gtk::CheckMenuItem * _poCMI, int _iPercent);
|
||||
virtual void vOnThrottleOther(Gtk::CheckMenuItem * _poCMI);
|
||||
virtual void vOnVideoFullscreen();
|
||||
virtual void vOnVideoOutputToggled(Gtk::CheckMenuItem * _poCMI, int _iOutput);
|
||||
virtual void vOnVideoScaleToggled(Gtk::CheckMenuItem * _poCMI, int _iScale);
|
||||
virtual void vOnLayerToggled(Gtk::CheckMenuItem * _poCMI, int _iLayer);
|
||||
|
@ -198,6 +199,7 @@ protected:
|
|||
virtual bool on_focus_out_event(GdkEventFocus * _pstEvent);
|
||||
virtual bool on_key_press_event(GdkEventKey * _pstEvent);
|
||||
virtual bool on_key_release_event(GdkEventKey * _pstEvent);
|
||||
virtual bool on_window_state_event(GdkEventWindowState* _pstEvent);
|
||||
|
||||
private:
|
||||
// Config limits
|
||||
|
@ -248,6 +250,7 @@ private:
|
|||
Gtk::CheckMenuItem * m_poFilePauseItem;
|
||||
Gtk::CheckMenuItem * m_poUseBiosItem;
|
||||
Gtk::CheckMenuItem * m_poSoundOffItem;
|
||||
Gtk::MenuBar * m_poMenuBar;
|
||||
|
||||
struct SGameSlot
|
||||
{
|
||||
|
@ -269,6 +272,7 @@ private:
|
|||
std::vector<JoypadConfig> m_oJoypads;
|
||||
Keymap * m_poKeymap;
|
||||
|
||||
int m_bFullscreen;
|
||||
int m_iScreenWidth;
|
||||
int m_iScreenHeight;
|
||||
|
||||
|
@ -311,6 +315,7 @@ private:
|
|||
void vSetThrottle(int _iPercent);
|
||||
void vSelectBestThrottleItem();
|
||||
void vUpdateGameSlots();
|
||||
void vToggleFullscreen();
|
||||
};
|
||||
|
||||
} // namespace VBA
|
||||
|
|
|
@ -590,6 +590,11 @@ void Window::vOnThrottleOther(Gtk::CheckMenuItem * _poCMI)
|
|||
vSelectBestThrottleItem();
|
||||
}
|
||||
|
||||
void Window::vOnVideoFullscreen()
|
||||
{
|
||||
vToggleFullscreen();
|
||||
}
|
||||
|
||||
void Window::vOnVideoOutputToggled(Gtk::CheckMenuItem * _poCMI, int _iOutput)
|
||||
{
|
||||
if (! _poCMI->get_active())
|
||||
|
@ -1323,6 +1328,13 @@ bool Window::on_key_press_event(GdkEventKey * _pstEvent)
|
|||
{
|
||||
EKey eKey;
|
||||
|
||||
// The menu accelerators are disabled when it is hidden
|
||||
if (_pstEvent->keyval == GDK_F11 && !m_poMenuBar->is_visible())
|
||||
{
|
||||
vToggleFullscreen();
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((_pstEvent->state & Gtk::AccelGroup::get_default_mod_mask())
|
||||
|| (eKey = m_poKeymap->eGetKey(_pstEvent->hardware_keycode)) == KeyNone)
|
||||
{
|
||||
|
@ -1431,4 +1443,14 @@ bool Window::on_key_release_event(GdkEventKey * _pstEvent)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Window::on_window_state_event(GdkEventWindowState* _pstEvent)
|
||||
{
|
||||
if (_pstEvent->changed_mask & GDK_WINDOW_STATE_FULLSCREEN)
|
||||
{
|
||||
m_bFullscreen = _pstEvent->new_window_state & GDK_WINDOW_STATE_FULLSCREEN;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace VBA
|
||||
|
|
Loading…
Reference in New Issue