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; 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 ) #if GTK_CHECK_VERSION( 1,3,0 )
static gint scroll_event( GtkWidget *widget, static gint scroll_event( GtkWidget *widget,
GdkEventScroll *event, GdkEventScroll *event,
@ -204,7 +189,7 @@ static gint scroll_event( GtkWidget *widget,
//#define DBG_GLWINDOW //#define DBG_GLWINDOW
#endif #endif
GLWindow::GLWindow ( bool zbuffer ){ GLWindow::GLWindow( bool zbuffer ) {
m_nTimer = 0; m_nTimer = 0;
m_bMouseCapture = FALSE; m_bMouseCapture = FALSE;
m_pParent = NULL; m_pParent = NULL;
@ -216,12 +201,9 @@ GLWindow::GLWindow ( bool zbuffer ){
Sys_Printf( "GLWindow::GLWindow m_pWidget = %p\n", m_pWidget ); Sys_Printf( "GLWindow::GLWindow m_pWidget = %p\n", m_pWidget );
#endif #endif
//! GtkGLExt port.
//#if defined (__linux__) || defined (__APPLE__)
if ( g_qeglobals_gui.d_glBase == NULL ) { if ( g_qeglobals_gui.d_glBase == NULL ) {
g_qeglobals_gui.d_glBase = m_pWidget; g_qeglobals_gui.d_glBase = m_pWidget;
} }
//#endif
#if GTK_CHECK_VERSION( 1,3,0 ) #if GTK_CHECK_VERSION( 1,3,0 )
gtk_widget_set_events( m_pWidget, GDK_DESTROY | GDK_EXPOSURE_MASK | 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_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 ), "button_release_event",GTK_SIGNAL_FUNC( button_release ), this );
gtk_signal_connect( GTK_OBJECT( m_pWidget ), "size_allocate", GTK_SIGNAL_FUNC( resize ), 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 ) #if GTK_CHECK_VERSION( 1,3,0 )
gtk_signal_connect( GTK_OBJECT( m_pWidget ), "scroll_event", GTK_SIGNAL_FUNC( scroll_event ), this ); gtk_signal_connect( GTK_OBJECT( m_pWidget ), "scroll_event", GTK_SIGNAL_FUNC( scroll_event ), this );
#endif #endif

View file

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

View file

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

View file

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