This commit is contained in:
Timothee "TTimo" Besset 2013-07-06 16:03:25 -05:00
parent 5df79a9c62
commit 1c1fa7173a
4 changed files with 44 additions and 90 deletions

View file

@ -172,21 +172,6 @@ static gint timer( gpointer data ){
return TRUE;
}
//! GtkGLExt port.
/*
static void create_context (GtkWidget *widget, gpointer data)
{
if (g_qeglobals_gui.d_glBase == NULL)
g_qeglobals_gui.d_glBase = widget;
}
static void destroy_context (GtkWidget *widget, gpointer data)
{
if (g_qeglobals_gui.d_glBase == widget)
g_qeglobals_gui.d_glBase = NULL;
}
*/
#if GTK_CHECK_VERSION( 1,3,0 )
static gint scroll_event( GtkWidget *widget,
GdkEventScroll *event,
@ -204,7 +189,7 @@ static gint scroll_event( GtkWidget *widget,
//#define DBG_GLWINDOW
#endif
GLWindow::GLWindow ( bool zbuffer ){
GLWindow::GLWindow( bool zbuffer ) {
m_nTimer = 0;
m_bMouseCapture = FALSE;
m_pParent = NULL;
@ -216,12 +201,9 @@ GLWindow::GLWindow ( bool zbuffer ){
Sys_Printf( "GLWindow::GLWindow m_pWidget = %p\n", m_pWidget );
#endif
//! GtkGLExt port.
//#if defined (__linux__) || defined (__APPLE__)
if ( g_qeglobals_gui.d_glBase == NULL ) {
g_qeglobals_gui.d_glBase = m_pWidget;
}
//#endif
#if GTK_CHECK_VERSION( 1,3,0 )
gtk_widget_set_events( m_pWidget, GDK_DESTROY | GDK_EXPOSURE_MASK |
@ -238,9 +220,6 @@ GLWindow::GLWindow ( bool zbuffer ){
gtk_signal_connect( GTK_OBJECT( m_pWidget ), "button_press_event", GTK_SIGNAL_FUNC( button_press ), this );
gtk_signal_connect( GTK_OBJECT( m_pWidget ), "button_release_event",GTK_SIGNAL_FUNC( button_release ), this );
gtk_signal_connect( GTK_OBJECT( m_pWidget ), "size_allocate", GTK_SIGNAL_FUNC( resize ), this );
//! GtkGLExt port.
// gtk_signal_connect (GTK_OBJECT (m_pWidget), "create_context", GTK_SIGNAL_FUNC (create_context), this);
// gtk_signal_connect (GTK_OBJECT (m_pWidget), "destroy_context", GTK_SIGNAL_FUNC (destroy_context), this);
#if GTK_CHECK_VERSION( 1,3,0 )
gtk_signal_connect( GTK_OBJECT( m_pWidget ), "scroll_event", GTK_SIGNAL_FUNC( scroll_event ), this );
#endif

View file

@ -31,72 +31,56 @@
#ifndef _GLWINDOW_H_
#define _GLWINDOW_H_
class GLWindow
{
class GLWindow {
public:
GLWindow ( bool zbuffer );
virtual ~GLWindow ();
GLWindow( bool zbuffer );
virtual ~GLWindow ();
bool MakeCurrent();
void SwapBuffers();
void SetTimer( guint millisec );
void KillTimer();
bool HasTimer()
{ return m_nTimer != 0; }
void DestroyContext();
void CreateContext();
bool MakeCurrent();
void SwapBuffers();
void SetTimer( guint millisec );
void KillTimer();
bool HasTimer() { return m_nTimer != 0; }
void DestroyContext();
void CreateContext();
virtual void OnCreate() { }
virtual void OnExpose() { }
virtual void OnCreate() { }
virtual void OnExpose() { }
virtual void OnLButtonDown( guint32 flags, int x, int y ) { }
virtual void OnRButtonDown( guint32 flags, int x, int y ) { }
virtual void OnMButtonDown( guint32 flags, int x, int y ) { }
virtual void OnLButtonUp( guint32 flags, int pointx, int pointy ) { }
virtual void OnRButtonUp( guint32 flags, int pointx, int pointy ) { }
virtual void OnMButtonUp( guint32 flags, int pointx, int pointy ) { }
virtual void OnMouseMove( guint32 flags, int pointx, int pointy ) { }
virtual void OnLButtonDown( guint32 flags, int x, int y ) { }
virtual void OnRButtonDown( guint32 flags, int x, int y ) { }
virtual void OnMButtonDown( guint32 flags, int x, int y ) { }
virtual void OnLButtonUp( guint32 flags, int pointx, int pointy ) { }
virtual void OnRButtonUp( guint32 flags, int pointx, int pointy ) { }
virtual void OnMButtonUp( guint32 flags, int pointx, int pointy ) { }
virtual void OnMouseMove( guint32 flags, int pointx, int pointy ) { }
virtual void OnSize( int cx, int cy ) { }
virtual void OnTimer() { }
virtual void OnSize( int cx, int cy ) { }
virtual void OnTimer() { }
virtual void OnMouseWheel( bool bUp ) { }
virtual void OnMouseWheel( bool bUp ) { }
void RedrawWindow() { gtk_widget_queue_draw( m_pWidget ); }
void RedrawWindow(){
gtk_widget_queue_draw( m_pWidget );
}
void SetFocus() { /* gdk_window_raise (m_pWidget->window); */ }
void SetFocus(){
/* gdk_window_raise (m_pWidget->window); */
}
void SetCapture() { m_bMouseCapture = TRUE; }
void ReleaseCapture() { m_bMouseCapture = FALSE; }
void SetCapture(){
m_bMouseCapture = TRUE;
}
bool HasCapture() { return m_bMouseCapture; }
void ReleaseCapture(){
m_bMouseCapture = FALSE;
}
bool HasCapture(){
return m_bMouseCapture;
}
GtkWidget* GetWidget(){
return m_pWidget;
}
GtkWidget * GetWidget() { return m_pWidget; }
// member variables
public:
GtkWidget* m_pParent; // for floating windows only
GtkWidget* m_pParent; // for floating windows only
protected:
bool m_bMouseCapture;
GtkWidget* m_pWidget;
bool m_bMouseCapture;
GtkWidget* m_pWidget;
private:
guint m_nTimer; // only one timer supported
guint m_nTimer; // only one timer supported
};
#endif //_GLWINDOW_H_

View file

@ -86,19 +86,17 @@ extern GtkWidget* EntWidgets[EntLast];
class GroupDlg
{
public:
GroupDlg ();
void Create();
GroupDlg();
void Create();
void Show()
{ gtk_widget_show( m_pWidget ); };
void Hide()
{ gtk_widget_hide( m_pWidget ); };
void Show() { gtk_widget_show( m_pWidget ); }
void Hide() { gtk_widget_hide( m_pWidget ); }
public:
GtkWidget* m_pNotebook;
GtkWidget* m_pWidget;
GtkWidget* m_pTree;
GtkCTreeNode* m_hWorld; //leo: not used keeping because of the win32 version
GtkWidget* m_pNotebook;
GtkWidget* m_pWidget;
GtkWidget* m_pTree;
GtkCTreeNode* m_hWorld; //leo: not used keeping because of the win32 version
};
extern GroupDlg *g_pGroupDlg;

View file

@ -54,11 +54,6 @@ static unsigned tex_palette[256];
#define FONT_HEIGHT 10
//int texture_mode = GL_NEAREST;
//int texture_mode = GL_NEAREST_MIPMAP_NEAREST;
//int texture_mode = GL_NEAREST_MIPMAP_LINEAR;
//int texture_mode = GL_LINEAR;
//int texture_mode = GL_LINEAR_MIPMAP_NEAREST;
int texture_mode = GL_LINEAR_MIPMAP_LINEAR;
int g_nTextureOffset = 0;
@ -124,8 +119,7 @@ int GetTextureExtensionCount(){
// hardcoded hack for png support
if ( g_pGameDescription->mGameFile == "sof2.game" ) {
return 3;
}
else{
} else {
return 2;
}
}
@ -1667,8 +1661,7 @@ void TexWnd::OnCreate(){
if ( g_PrefsDlg.m_bTextureScrollbar ) {
gtk_widget_show( g_qeglobals_gui.d_texture_scroll );
}
else{
} else {
gtk_widget_hide( g_qeglobals_gui.d_texture_scroll );
}
m_bNeedRange = true;
@ -1695,7 +1688,7 @@ void TexWnd::OnSize( int cx, int cy ){
m_bNeedRange = true;
}
void TexWnd::OnExpose(){
void TexWnd::OnExpose() {
int nOld = g_qeglobals.d_texturewin.m_nTotalHeight;
if ( !MakeCurrent() ) {
Sys_Printf( "ERROR: glXMakeCurrent failed..\n " );