Commit 5a89c8a8 authored by Cyril Deguet's avatar Cyril Deguet

* it works !

parent 06151e89
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk2_bitmap.cpp: GTK2 implementation of the Bitmap class * gtk2_bitmap.cpp: GTK2 implementation of the Bitmap class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: gtk2_bitmap.cpp,v 1.6 2003/04/14 17:56:45 karibu Exp $ * $Id: gtk2_bitmap.cpp,v 1.7 2003/04/14 20:07:49 asmax Exp $
* *
* Authors: Cyril Deguet <asmax@videolan.org> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -163,14 +163,11 @@ void GTK2Bitmap::DrawBitmap( int x, int y, int w, int h, int xRef, int yRef, ...@@ -163,14 +163,11 @@ void GTK2Bitmap::DrawBitmap( int x, int y, int w, int h, int xRef, int yRef,
// New method, not available in win95 // New method, not available in win95
TransparentBlt( destDC, xRef, yRef, w, h, bmpDC, x, y, w, h, AlphaColor ); TransparentBlt( destDC, xRef, yRef, w, h, bmpDC, x, y, w, h, AlphaColor );
*/ */
GdkDrawable *destImg = ( (GTK2Graphics *)dest )->GetImageHandle(); GdkDrawable *destImg = ( (GTK2Graphics *)dest )->GetImage();
GdkGC *destGC = ( (GTK2Graphics *)dest )->GetGC();
GdkGC *gc = gdk_gc_new( destImg );
/*gdk_pixbuf_render_to_drawable( Bmp, destImg, gc, 0, 0, x, y, w, h, gdk_pixbuf_render_to_drawable( Bmp, destImg, destGC, x, y, xRef, yRef,
GDK_RGB_DITHER_NONE, 0, 0);*/ w, h, GDK_RGB_DITHER_NONE, 0, 0);
fprintf(stderr, "draw %d %d %d %d\n", xRef, yRef, w, h);
gdk_pixbuf_render_to_drawable( Bmp, destImg, gc, 0, 0, xRef, yRef, w, h,
GDK_RGB_DITHER_NONE, 0, 0);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool GTK2Bitmap::Hit( int x, int y) bool GTK2Bitmap::Hit( int x, int y)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk2_graphics.cpp: GTK2 implementation of the Graphics and Region classes * gtk2_graphics.cpp: GTK2 implementation of the Graphics and Region classes
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: gtk2_graphics.cpp,v 1.5 2003/04/13 20:07:34 asmax Exp $ * $Id: gtk2_graphics.cpp,v 1.6 2003/04/14 20:07:49 asmax Exp $
* *
* Authors: Cyril Deguet <asmax@videolan.org> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include "os_window.h" #include "os_window.h"
#include "gtk2_graphics.h" #include "gtk2_graphics.h"
#include <stdio.h>
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// GTK2 GRAPHICS // GTK2 GRAPHICS
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -53,8 +55,18 @@ GTK2Graphics::GTK2Graphics( int w, int h, Window *from ) : Graphics( w, h ) ...@@ -53,8 +55,18 @@ GTK2Graphics::GTK2Graphics( int w, int h, Window *from ) : Graphics( w, h )
SelectObject( Image, HImage ); SelectObject( Image, HImage );
DeleteObject( HImage );*/ DeleteObject( HImage );*/
Image = ( GdkDrawable* )( (GTK2Window *)from )->GetHandle(); if( from != NULL )
{
GdkWindow *fromWnd = ( (GTK2Window *)from )->GetHandle();
Image = (GdkDrawable*) gdk_pixmap_new( fromWnd, w, h, -1 );
Gc = gdk_gc_new( ( GdkDrawable* )fromWnd );
}
else
{
Image = (GdkDrawable*) gdk_pixmap_new( NULL, w, h, 8 );
gdk_drawable_set_colormap( Image, gdk_colormap_get_system() );
Gc = gdk_gc_new( Image ); Gc = gdk_gc_new( Image );
}
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
GTK2Graphics::~GTK2Graphics() GTK2Graphics::~GTK2Graphics()
...@@ -67,6 +79,9 @@ void GTK2Graphics::CopyFrom( int dx, int dy, int dw, int dh, Graphics *Src, ...@@ -67,6 +79,9 @@ void GTK2Graphics::CopyFrom( int dx, int dy, int dw, int dh, Graphics *Src,
{ {
/* BitBlt( Image, dx, dy, dw, dh, ( (GTK2Graphics *)Src )->GetImageHandle(), /* BitBlt( Image, dx, dy, dw, dh, ( (GTK2Graphics *)Src )->GetImageHandle(),
sx, sy, Flag );*/ sx, sy, Flag );*/
fprintf(stderr, "%d %d %d %d %d %d\n", sx, sy, dx, dy, dw, dh);
gdk_draw_drawable( Image, Gc, (( GTK2Graphics* )Src )->GetImage(),
sx, sy, dx, dy, dw, dh );
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk2_graphics.h: GTK2 implementation of the Graphics and Region classes * gtk2_graphics.h: GTK2 implementation of the Graphics and Region classes
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: gtk2_graphics.h,v 1.2 2003/04/13 17:46:22 asmax Exp $ * $Id: gtk2_graphics.h,v 1.3 2003/04/14 20:07:49 asmax Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -58,7 +58,8 @@ class GTK2Graphics : public Graphics ...@@ -58,7 +58,8 @@ class GTK2Graphics : public Graphics
virtual void SetClipRegion( Region *rgn ); virtual void SetClipRegion( Region *rgn );
// Specific GTK2 methods // Specific GTK2 methods
GdkDrawable *GetImageHandle() { return Image; }; GdkDrawable *GetImage() { return Image; };
GdkGC *GetGC() { return Gc; };
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
class GTK2Region : public Region class GTK2Region : public Region
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk2_theme.cpp: GTK2 implementation of the Theme class * gtk2_theme.cpp: GTK2 implementation of the Theme class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: gtk2_theme.cpp,v 1.7 2003/04/14 18:05:35 asmax Exp $ * $Id: gtk2_theme.cpp,v 1.8 2003/04/14 20:07:49 asmax Exp $
* *
* Authors: Cyril Deguet <asmax@videolan.org> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -264,10 +264,10 @@ void GTK2Theme::OnLoadTheme() ...@@ -264,10 +264,10 @@ void GTK2Theme::OnLoadTheme()
GdkWindowAttr attr; GdkWindowAttr attr;
attr.title = "VLC Media Player"; attr.title = "VLC Media Player";
attr.event_mask = GDK_ALL_EVENTS_MASK; attr.event_mask = GDK_ALL_EVENTS_MASK;
attr.x = 100; attr.x = 0;
attr.y = 100; attr.y = 0;
attr.width = 400; attr.width = 0;
attr.height = 150; attr.height = 0;
attr.window_type = GDK_WINDOW_TOPLEVEL; attr.window_type = GDK_WINDOW_TOPLEVEL;
attr.wclass = GDK_INPUT_ONLY; attr.wclass = GDK_INPUT_ONLY;
attr.override_redirect = FALSE; attr.override_redirect = FALSE;
...@@ -277,7 +277,7 @@ void GTK2Theme::OnLoadTheme() ...@@ -277,7 +277,7 @@ void GTK2Theme::OnLoadTheme()
// Create the parent window // Create the parent window
ParentWindow = gdk_window_new( NULL, &attr, mask); ParentWindow = gdk_window_new( NULL, &attr, mask);
gdk_window_show( ParentWindow ); // gdk_window_show( ParentWindow );
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void GTK2Theme::AddSystemMenu( string name, Event *event ) void GTK2Theme::AddSystemMenu( string name, Event *event )
...@@ -322,13 +322,13 @@ void GTK2Theme::AddWindow( string name, int x, int y, bool visible, ...@@ -322,13 +322,13 @@ void GTK2Theme::AddWindow( string name, int x, int y, bool visible,
attr.event_mask = GDK_ALL_EVENTS_MASK; attr.event_mask = GDK_ALL_EVENTS_MASK;
attr.width = 0; attr.width = 0;
attr.height = 0; attr.height = 0;
attr.window_type = GDK_WINDOW_CHILD; attr.window_type = GDK_WINDOW_TOPLEVEL;
attr.wclass = GDK_INPUT_OUTPUT; attr.wclass = GDK_INPUT_OUTPUT;
gint mask =0; gint mask =0;
// Create the window // Create the window
GdkWindow *gwnd = gdk_window_new( ParentWindow, &attr, mask ); GdkWindow *gwnd = gdk_window_new( NULL, &attr, mask );
if( !gwnd ) if( !gwnd )
{ {
msg_Err( p_intf, "CreateWindow failed" ); msg_Err( p_intf, "CreateWindow failed" );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk2_window.cpp: GTK2 implementation of the Window class * gtk2_window.cpp: GTK2 implementation of the Window class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: gtk2_window.cpp,v 1.6 2003/04/14 17:03:42 asmax Exp $ * $Id: gtk2_window.cpp,v 1.7 2003/04/14 20:07:49 asmax Exp $
* *
* Authors: Cyril Deguet <asmax@videolan.org> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -70,6 +70,7 @@ GTK2Window::GTK2Window( intf_thread_t *p_intf, GdkWindow *gwnd, int x, int y, ...@@ -70,6 +70,7 @@ GTK2Window::GTK2Window( intf_thread_t *p_intf, GdkWindow *gwnd, int x, int y,
{ {
// Set handles // Set handles
gWnd = gwnd; gWnd = gwnd;
gc = gdk_gc_new( gwnd );
/* /*
// Set position parameters // Set position parameters
CursorPos = new POINT; CursorPos = new POINT;
...@@ -234,7 +235,12 @@ void GTK2Window::RefreshFromImage( int x, int y, int w, int h ) ...@@ -234,7 +235,12 @@ void GTK2Window::RefreshFromImage( int x, int y, int w, int h )
// Release window device context // Release window device context
ReleaseDC( hWnd, DC ); ReleaseDC( hWnd, DC );
*/ */
fprintf(stderr, "window %d %d %d %d\n", x, y, w, h);
gdk_draw_drawable( gWnd, gc, (( GTK2Graphics* )Image )->GetImage(),
x, y, x, y, w, h );
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void GTK2Window::WindowManualMove() void GTK2Window::WindowManualMove()
...@@ -271,7 +277,6 @@ void GTK2Window::Move( int left, int top ) ...@@ -271,7 +277,6 @@ void GTK2Window::Move( int left, int top )
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void GTK2Window::Size( int width, int height ) void GTK2Window::Size( int width, int height )
{ {
fprintf(stderr, "size %d %d\n", width, height);
Width = width; Width = width;
Height = height; Height = height;
gdk_window_resize( gWnd, width, height ); gdk_window_resize( gWnd, width, height );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk2_window.h: GTK2 implementation of the Window class * gtk2_window.h: GTK2 implementation of the Window class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: gtk2_window.h,v 1.2 2003/04/13 17:46:22 asmax Exp $ * $Id: gtk2_window.h,v 1.3 2003/04/14 20:07:49 asmax Exp $
* *
* Authors: Cyril Deguet <asmax@videolan.org> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -39,6 +39,7 @@ class GTK2Window : public Window ...@@ -39,6 +39,7 @@ class GTK2Window : public Window
private: private:
// General parameters // General parameters
GdkWindow *gWnd; GdkWindow *gWnd;
GdkGC *gc;
// LPPOINT CursorPos; // LPPOINT CursorPos;
// LPPOINT WindowPos; // LPPOINT WindowPos;
...@@ -73,7 +74,7 @@ class GTK2Window : public Window ...@@ -73,7 +74,7 @@ class GTK2Window : public Window
virtual void Size( int width, int height ); virtual void Size( int width, int height );
// Specific gtk2 methods // Specific gtk2 methods
GdkWindow *GetHandle() {return gWnd; }; GdkWindow *GetHandle() { return gWnd; };
// Tooltip texts // Tooltip texts
virtual void ChangeToolTipText( string text ); virtual void ChangeToolTipText( string text );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* window.cpp: Window class * window.cpp: Window class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: window.cpp,v 1.7 2003/04/13 20:07:34 asmax Exp $ * $Id: window.cpp,v 1.8 2003/04/14 20:07:49 asmax Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -409,6 +409,8 @@ void Window::Init() ...@@ -409,6 +409,8 @@ void Window::Init()
// Refresh Image buffer // Refresh Image buffer
RefreshImage( 0, 0, Width, Height ); RefreshImage( 0, 0, Width, Height );
fprintf(stderr, "kludge in window.cpp!\n");
RefreshFromImage( 0, 0, Width, Height );
// Move window as it hasn't been moved yet // Move window as it hasn't been moved yet
Move( Left, Top ); Move( Left, Top );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment