Commit 9ca2bbfb authored by Cyril Deguet's avatar Cyril Deguet

* x11_font.cpp: fixed font placement

* x11_window.*: real tooltip windows ! not perfect yet but it looks cool !
* removed compilation of gtk2 skins module. If you want it back, good luck ;)
parent fdfb00e9
...@@ -2441,29 +2441,16 @@ if test "x${enable_skins}" != "xno"; then ...@@ -2441,29 +2441,16 @@ if test "x${enable_skins}" != "xno"; then
LDFLAGS_skins="${LDFLAGS_skins} -loleaut32 -lwinspool -lwinmm -lshell32 -lctl3d32 -ladvapi32 -lwsock32 -lstdc++ -lgdi32 -lcomdlg32 -lole32 -luuid -lcomctl32" LDFLAGS_skins="${LDFLAGS_skins} -loleaut32 -lwinspool -lwinmm -lshell32 -lctl3d32 -ladvapi32 -lwsock32 -lstdc++ -lgdi32 -lcomdlg32 -lole32 -luuid -lcomctl32"
else else
if test "x${enable_skins}" = "xyes"; then if test "x${enable_skins}" = "xyes"; then
IMLIB2_PATH="${PATH}"
AC_ARG_WITH(gtk2-skins, AC_PATH_PROG(IMLIB2_CONFIG_SKINS, imlib2-config, no, ${IMLIB2_PATH})
[ --with-gtk2-skins skins using GTK2 (default disabled)]) if test "x${IMLIB2_CONFIG_SKINS}" = "xno"; then
AC_MSG_ERROR([Couldn't find the imlib2 package. You can download imlib2 from http://enlightenment.org/, or configure with --disable-skins.])
if test "x${with_gtk2_skins}" = "xyes"; then
PKG_CHECK_MODULES(GTK2, [gtk+-2.0 >= 2.0.0, gthread-2.0])
CPPFLAGS_skins="${CPPFLAGS_skins} -O2 -fno-rtti -Imodules/gui/skins ${GTK2_CFLAGS} -DGTK2_SKINS"
LDFLAGS_skins="${LDFLAGS_skins} -lstdc++ ${GTK2_LIBS}"
else
IMLIB2_PATH="${PATH}"
AC_PATH_PROG(IMLIB2_CONFIG_SKINS, imlib2-config, no, ${IMLIB2_PATH})
if test "x${IMLIB2_CONFIG_SKINS}" = "xno"; then
AC_MSG_ERROR([Couldn't find the imlib2 package. You can download imlib2 from http://enlightenment.org/, or configure with --disable-skins.])
fi
PLUGINS="${PLUGINS} skins"
CPPFLAGS_skins="${CPPFLAGS_skins} -O2 -fno-rtti -Imodules/gui/skins -I${x_includes} `${IMLIB2_CONFIG_SKINS} --cflags` -DX11_SKINS"
LDFLAGS_skins="${LDFLAGS_skins} -lstdc++ -L${x_libraries} -lXext -lX11 `${IMLIB2_CONFIG_SKINS} --libs`"
fi fi
PLUGINS="${PLUGINS} skins" PLUGINS="${PLUGINS} skins"
CPPFLAGS_skins="${CPPFLAGS_skins} -O2 -fno-rtti -Imodules/gui/skins -I${x_includes} `${IMLIB2_CONFIG_SKINS} --cflags` -DX11_SKINS"
LDFLAGS_skins="${LDFLAGS_skins} -lstdc++ -L${x_libraries} -lXext -lX11 `${IMLIB2_CONFIG_SKINS} --libs`"
PLUGINS="${PLUGINS} skins"
fi fi
fi fi
fi fi
...@@ -2480,25 +2467,14 @@ if test "x${enable_basic_skins}" = "xyes"; then ...@@ -2480,25 +2467,14 @@ if test "x${enable_basic_skins}" = "xyes"; then
LDFLAGS_basic_skins="${LDFLAGS_basic_skins} -loleaut32 -lwinspool -lwinmm -lshell32 -lctl3d32 -ladvapi32 -lwsock32 -lstdc++ -lgdi32 -lcomdlg32 -lole32 -luuid -lcomctl32" LDFLAGS_basic_skins="${LDFLAGS_basic_skins} -loleaut32 -lwinspool -lwinmm -lshell32 -lctl3d32 -ladvapi32 -lwsock32 -lstdc++ -lgdi32 -lcomdlg32 -lole32 -luuid -lcomctl32"
else else
AC_ARG_WITH(gtk2-basic-skins, IMLIB2_PATH="${PATH}"
[ --with-gtk2-basic-skins skins using GTK2 (default disabled)]) AC_PATH_PROG(IMLIB2_CONFIG_SKINS, imlib2-config, no, ${IMLIB2_PATH})
if test "x${IMLIB2_CONFIG_SKINS}" = "xno"; then
if test "x${with_gtk2_basic_skins}" = "xyes"; then AC_MSG_ERROR([Couldn't find the imlib2 package. You can download imlib2 from http://enlightenment.org/, or configure with --disable-basic-skins.])
PKG_CHECK_MODULES(GTK2, [gtk+-2.0 >= 2.0.0, gthread-2.0])
CPPFLAGS_basic_skins="${CPPFLAGS_basic_skins} -O2 -fno-rtti -Imodules/gui/skins ${GTK2_CFLAGS} -DGTK2_SKINS"
LDFLAGS_basic_skins="${LDFLAGS_basic_skins} -lstdc++ ${GTK2_LIBS}"
else
IMLIB2_PATH="${PATH}"
AC_PATH_PROG(IMLIB2_CONFIG_SKINS, imlib2-config, no, ${IMLIB2_PATH})
if test "x${IMLIB2_CONFIG_SKINS}" = "xno"; then
AC_MSG_ERROR([Couldn't find the imlib2 package. You can download imlib2 from http://enlightenment.org/, or configure with --disable-basic-skins.])
fi
CPPFLAGS_basic_skins="${CPPFLAGS_basic_skins} -O2 -fno-rtti -Imodules/gui/skins -I${x_includes} `${IMLIB2_CONFIG_SKINS} --cflags` -DX11_SKINS"
LDFLAGS_basic_skins="${LDFLAGS_basic_skins} -lstdc++ -L${x_libraries} -lXext -lX11 `${IMLIB2_CONFIG_SKINS} --libs`"
fi fi
CPPFLAGS_basic_skins="${CPPFLAGS_basic_skins} -O2 -fno-rtti -Imodules/gui/skins -I${x_includes} `${IMLIB2_CONFIG_SKINS} --cflags` -DX11_SKINS"
LDFLAGS_basic_skins="${LDFLAGS_basic_skins} -lstdc++ -L${x_libraries} -lXext -lX11 `${IMLIB2_CONFIG_SKINS} --libs`"
fi fi
PLUGINS="${PLUGINS} basic_skins" PLUGINS="${PLUGINS} basic_skins"
......
...@@ -75,23 +75,6 @@ COMMON_skins = \ ...@@ -75,23 +75,6 @@ COMMON_skins = \
modules/gui/skins/win32/win32_window.cpp \ modules/gui/skins/win32/win32_window.cpp \
modules/gui/skins/win32/win32_window.h \ modules/gui/skins/win32/win32_window.h \
\ \
modules/gui/skins/gtk2/gtk2_api.cpp \
modules/gui/skins/gtk2/gtk2_bitmap.cpp \
modules/gui/skins/gtk2/gtk2_bitmap.h \
modules/gui/skins/gtk2/gtk2_dragdrop.cpp \
modules/gui/skins/gtk2/gtk2_dragdrop.h \
modules/gui/skins/gtk2/gtk2_event.cpp \
modules/gui/skins/gtk2/gtk2_event.h \
modules/gui/skins/gtk2/gtk2_font.cpp \
modules/gui/skins/gtk2/gtk2_font.h \
modules/gui/skins/gtk2/gtk2_graphics.cpp \
modules/gui/skins/gtk2/gtk2_graphics.h \
modules/gui/skins/gtk2/gtk2_run.cpp \
modules/gui/skins/gtk2/gtk2_theme.cpp \
modules/gui/skins/gtk2/gtk2_theme.h \
modules/gui/skins/gtk2/gtk2_window.cpp \
modules/gui/skins/gtk2/gtk2_window.h \
\
modules/gui/skins/x11/x11_api.cpp \ modules/gui/skins/x11/x11_api.cpp \
modules/gui/skins/x11/x11_bitmap.cpp \ modules/gui/skins/x11/x11_bitmap.cpp \
modules/gui/skins/x11/x11_bitmap.h \ modules/gui/skins/x11/x11_bitmap.h \
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11_font.cpp: X11 implementation of the Font class * x11_font.cpp: X11 implementation of the Font class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: x11_font.cpp,v 1.7 2003/06/06 23:34:35 asmax Exp $ * $Id: x11_font.cpp,v 1.8 2003/06/08 00:32:07 asmax Exp $
* *
* Authors: Cyril Deguet <asmax@videolan.org> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -59,6 +59,7 @@ X11Font::X11Font( intf_thread_t *_p_intf, string fontname, int size, ...@@ -59,6 +59,7 @@ X11Font::X11Font( intf_thread_t *_p_intf, string fontname, int size,
XLOCK; XLOCK;
font = XLoadFont( display, name ); font = XLoadFont( display, name );
FontInfo = XQueryFont( display, font );
XUNLOCK; XUNLOCK;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -81,7 +82,7 @@ void X11Font::GetSize( string text, int &w, int &h ) ...@@ -81,7 +82,7 @@ void X11Font::GetSize( string text, int &w, int &h )
XUNLOCK; XUNLOCK;
w = overall.rbearing - overall.lbearing; w = overall.rbearing - overall.lbearing;
h = overall.ascent + overall.descent; h = FontInfo->max_bounds.ascent + FontInfo->max_bounds.descent;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void X11Font::GenericPrint( Graphics *dest, string text, int x, int y, void X11Font::GenericPrint( Graphics *dest, string text, int x, int y,
...@@ -99,7 +100,7 @@ void X11Font::GenericPrint( Graphics *dest, string text, int x, int y, ...@@ -99,7 +100,7 @@ void X11Font::GenericPrint( Graphics *dest, string text, int x, int y,
rect.x = x; rect.x = x;
rect.y = y; rect.y = y;
rect.width = w; rect.width = w;
rect.height = h+1; rect.height = h;
XLOCK; XLOCK;
XChangeGC( display, gc, GCForeground|GCFont, &gcVal ); XChangeGC( display, gc, GCForeground|GCFont, &gcVal );
...@@ -107,10 +108,12 @@ void X11Font::GenericPrint( Graphics *dest, string text, int x, int y, ...@@ -107,10 +108,12 @@ void X11Font::GenericPrint( Graphics *dest, string text, int x, int y,
XSetClipRectangles( display, gc, 0, 0, &rect, 1, Unsorted ); XSetClipRectangles( display, gc, 0, 0, &rect, 1, Unsorted );
// Render text no the drawable // Render text no the drawable
XDrawString( display, drawable, gc, x, y+h, text.c_str(), text.size()); XDrawString( display, drawable, gc, x, y+FontInfo->max_bounds.ascent,
text.c_str(), text.size());
if( Underline ) if( Underline )
{ {
XDrawLine( display, drawable, gc, x, y+h, x+w, y+h ); XDrawLine( display, drawable, gc, x, y+FontInfo->max_bounds.ascent+1,
x+w, y+FontInfo->max_bounds.ascent+1 );
} }
// Reset the clip mask // Reset the clip mask
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11_font.h: X11 implementation of the Font class * x11_font.h: X11 implementation of the Font class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: x11_font.h,v 1.3 2003/06/06 21:47:18 asmax Exp $ * $Id: x11_font.h,v 1.4 2003/06/08 00:32:07 asmax Exp $
* *
* Authors: Cyril Deguet <asmax@videolan.org> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -43,6 +43,7 @@ class X11Font : SkinFont ...@@ -43,6 +43,7 @@ class X11Font : SkinFont
private: private:
Display *display; Display *display;
Font font; Font font;
XFontStruct *FontInfo;
bool Underline; bool Underline;
// Assign font to Device Context // Assign font to Device Context
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11_run.cpp: * x11_run.cpp:
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: x11_run.cpp,v 1.17 2003/06/07 12:19:23 asmax Exp $ * $Id: x11_run.cpp,v 1.18 2003/06/08 00:32:07 asmax Exp $
* *
* Authors: Cyril Deguet <asmax@videolan.org> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -168,7 +168,7 @@ void OSRun( intf_thread_t *p_intf ) ...@@ -168,7 +168,7 @@ void OSRun( intf_thread_t *p_intf )
// Timer for SkinManage // Timer for SkinManage
X11Timer *refreshTimer = new X11Timer( p_intf, 100000, RefreshCallback, X11Timer *refreshTimer = new X11Timer( p_intf, 100, RefreshCallback,
(void*)p_intf ); (void*)p_intf );
X11TimerManager *timerManager = X11TimerManager::Instance( p_intf ); X11TimerManager *timerManager = X11TimerManager::Instance( p_intf );
timerManager->addTimer( refreshTimer ); timerManager->addTimer( refreshTimer );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11_window.cpp: X11 implementation of the Window class * x11_window.cpp: X11 implementation of the Window class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: x11_window.cpp,v 1.12 2003/06/07 12:19:23 asmax Exp $ * $Id: x11_window.cpp,v 1.13 2003/06/08 00:32:07 asmax Exp $
* *
* Authors: Cyril Deguet <asmax@videolan.org> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -92,10 +92,33 @@ X11Window::X11Window( intf_thread_t *p_intf, Window wnd, int x, int y, ...@@ -92,10 +92,33 @@ X11Window::X11Window( intf_thread_t *p_intf, Window wnd, int x, int y,
} }
// Create Tool Tip window // Create Tool Tip window
ToolTipWindow = XCreateSimpleWindow( display, wnd, 0, 0, 1, 1, 0, 0, 0 ); XColor color;
X11Timer *timer = new X11Timer( p_intf, 100, ToolTipCallback, &ToolTipInfo ); color.red = 0xffff;
ToolTipInfo.p_intf = p_intf; color.green = 0xffff;
ToolTipInfo.timer = timer; color.blue = 0xa000;
Colormap cm = DefaultColormap( display, screen );
Window root = DefaultRootWindow( display );
XLOCK;
XAllocColor( display, cm, &color );
XSetWindowAttributes attr;
attr.background_pixel = color.pixel;
attr.override_redirect = True;
ToolTip.window = XCreateWindow( display, root, 0, 0, 1, 1, 1, 0, InputOutput,
CopyFromParent, CWBackPixel|CWOverrideRedirect, &attr );
XGCValues gcVal;
ToolTip.font = XLoadFont( display, "-*-helvetica-bold-r-*-*-*-80-*-*-*-*-*-*" );
gcVal.font = ToolTip.font;
gcVal.foreground = 0;
gcVal.background = color.pixel;
ToolTip.gc = XCreateGC( display, ToolTip.window,
GCBackground|GCForeground|GCFont, &gcVal );
XUNLOCK;
ToolTip.display = display;
X11Timer *timer = new X11Timer( p_intf, 100, ToolTipCallback, &ToolTip );
ToolTip.p_intf = p_intf;
ToolTip.timer = timer;
// Double-click handling // Double-click handling
ClickedX = 0; ClickedX = 0;
...@@ -115,7 +138,7 @@ X11Window::~X11Window() ...@@ -115,7 +138,7 @@ X11Window::~X11Window()
{ {
DestroyWindow( hWnd ); DestroyWindow( hWnd );
}*/ }*/
XDestroyWindow( display, ToolTipWindow ); XDestroyWindow( display, ToolTip.window );
/* /*
if( DragDrop ) if( DragDrop )
{ {
...@@ -289,6 +312,10 @@ void X11Window::RefreshFromImage( int x, int y, int w, int h ) ...@@ -289,6 +312,10 @@ void X11Window::RefreshFromImage( int x, int y, int w, int h )
XImage *image = XGetImage( display, drawable, 0, 0, Width, Height, XImage *image = XGetImage( display, drawable, 0, 0, Width, Height,
AllPlanes, ZPixmap ); AllPlanes, ZPixmap );
if( !image )
{
msg_Err( p_intf, "X11Window::RefreshFromImage failed");
}
// Mask for transparency // Mask for transparency
Region region = XCreateRegion(); Region region = XCreateRegion();
...@@ -362,7 +389,31 @@ void X11Window::Size( int width, int height ) ...@@ -362,7 +389,31 @@ void X11Window::Size( int width, int height )
bool ToolTipCallback( void *data ) bool ToolTipCallback( void *data )
{ {
fprintf(stderr," TOOLTIP: %s\n", ((tooltip_t*)data)->text.c_str()); int direction, fontAscent, fontDescent;
Display *disp = ((tooltip_t*)data)->display;
Window win = ((tooltip_t*)data)->window;
Font font = ((tooltip_t*)data)->font;
GC gc = ((tooltip_t*)data)->gc;
string text = ((tooltip_t*)data)->text;
int curX = ((tooltip_t*)data)->curX;
int curY = ((tooltip_t*)data)->curY;
XLOCK;
XClearWindow( disp, win );
XCharStruct overall;
XQueryTextExtents( disp, font, text.c_str(), text.size(), &direction,
&fontAscent, &fontDescent, &overall );
int w = overall.rbearing - overall.lbearing;
int h = overall.ascent + overall.descent;
XMapRaised( disp, win );
XMoveWindow( disp, win, curX - w/4, curY + 20 );
XResizeWindow( disp, win, w+8, h+8 );
XDrawString( disp, win, gc, 4, overall.ascent+4, text.c_str(),
text.size() );
XSync( disp, 0 );
XUNLOCK;
return False; return False;
} }
...@@ -374,8 +425,14 @@ void X11Window::ChangeToolTipText( string text ) ...@@ -374,8 +425,14 @@ void X11Window::ChangeToolTipText( string text )
if( ToolTipText != "none" ) if( ToolTipText != "none" )
{ {
ToolTipText = "none"; ToolTipText = "none";
// ToolTipInfo.lpszText = NULL; XLOCK;
// SendMessage( ToolTipWindow, TTM_ACTIVATE, 0 , 0 ); // Hide the tooltip window
X11TimerManager *timerManager = X11TimerManager::Instance( p_intf );
timerManager->removeTimer( ToolTip.timer );
XUnmapWindow( display, ToolTip.window );
XResizeWindow( display, ToolTip.window, 1, 1 );
XSync( display, 0 );
XUNLOCK;
} }
} }
else else
...@@ -383,10 +440,10 @@ void X11Window::ChangeToolTipText( string text ) ...@@ -383,10 +440,10 @@ void X11Window::ChangeToolTipText( string text )
if( text != ToolTipText ) if( text != ToolTipText )
{ {
ToolTipText = text; ToolTipText = text;
ToolTipInfo.text = text; ToolTip.text = text;
OSAPI_GetMousePos( ToolTip.curX, ToolTip.curY );
X11TimerManager *timerManager = X11TimerManager::Instance( p_intf ); X11TimerManager *timerManager = X11TimerManager::Instance( p_intf );
timerManager->addTimer( ToolTipInfo.timer ); timerManager->addTimer( ToolTip.timer );
// ToolTipInfo.lpszText = (char *)ToolTipText.c_str();
} }
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11_window.h: X11 implementation of the Window class * x11_window.h: X11 implementation of the Window class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: x11_window.h,v 1.4 2003/06/07 12:19:23 asmax Exp $ * $Id: x11_window.h,v 1.5 2003/06/08 00:32:07 asmax Exp $
* *
* Authors: Cyril Deguet <asmax@videolan.org> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -41,6 +41,12 @@ typedef struct ...@@ -41,6 +41,12 @@ typedef struct
intf_thread_t *p_intf; intf_thread_t *p_intf;
X11Timer *timer; X11Timer *timer;
string text; string text;
Display *display;
Window window;
GC gc;
Font font;
int curX;
int curY;
} tooltip_t; } tooltip_t;
...@@ -62,8 +68,7 @@ class X11Window : public SkinWindow ...@@ -62,8 +68,7 @@ class X11Window : public SkinWindow
X11DropObject *DropObject; X11DropObject *DropObject;
// Tooltip texts // Tooltip texts
Window ToolTipWindow; tooltip_t ToolTip;
tooltip_t ToolTipInfo;
// Double-click handling // Double-click handling
int ClickedX; int ClickedX;
......
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