* 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 ;)
This commit is contained in:
Cyril Deguet 2003-06-08 00:32:07 +00:00
parent fdfb00e9d5
commit 9ca2bbfbde
7 changed files with 102 additions and 77 deletions

View File

@ -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"
else
if test "x${enable_skins}" = "xyes"; then
AC_ARG_WITH(gtk2-skins,
[ --with-gtk2-skins skins using GTK2 (default disabled)])
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`"
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`"
PLUGINS="${PLUGINS} skins"
fi
fi
fi
@ -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"
else
AC_ARG_WITH(gtk2-basic-skins,
[ --with-gtk2-basic-skins skins using GTK2 (default disabled)])
if test "x${with_gtk2_basic_skins}" = "xyes"; then
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`"
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
PLUGINS="${PLUGINS} basic_skins"

View File

@ -75,23 +75,6 @@ COMMON_skins = \
modules/gui/skins/win32/win32_window.cpp \
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_bitmap.cpp \
modules/gui/skins/x11/x11_bitmap.h \

View File

@ -2,7 +2,7 @@
* x11_font.cpp: X11 implementation of the Font class
*****************************************************************************
* 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>
*
@ -59,6 +59,7 @@ X11Font::X11Font( intf_thread_t *_p_intf, string fontname, int size,
XLOCK;
font = XLoadFont( display, name );
FontInfo = XQueryFont( display, font );
XUNLOCK;
}
//---------------------------------------------------------------------------
@ -81,7 +82,7 @@ void X11Font::GetSize( string text, int &w, int &h )
XUNLOCK;
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,
@ -99,7 +100,7 @@ void X11Font::GenericPrint( Graphics *dest, string text, int x, int y,
rect.x = x;
rect.y = y;
rect.width = w;
rect.height = h+1;
rect.height = h;
XLOCK;
XChangeGC( display, gc, GCForeground|GCFont, &gcVal );
@ -107,10 +108,12 @@ void X11Font::GenericPrint( Graphics *dest, string text, int x, int y,
XSetClipRectangles( display, gc, 0, 0, &rect, 1, Unsorted );
// 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 )
{
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

View File

@ -2,7 +2,7 @@
* x11_font.h: X11 implementation of the Font class
*****************************************************************************
* 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>
*
@ -43,6 +43,7 @@ class X11Font : SkinFont
private:
Display *display;
Font font;
XFontStruct *FontInfo;
bool Underline;
// Assign font to Device Context

View File

@ -2,7 +2,7 @@
* x11_run.cpp:
*****************************************************************************
* 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>
*
@ -168,7 +168,7 @@ void OSRun( intf_thread_t *p_intf )
// Timer for SkinManage
X11Timer *refreshTimer = new X11Timer( p_intf, 100000, RefreshCallback,
X11Timer *refreshTimer = new X11Timer( p_intf, 100, RefreshCallback,
(void*)p_intf );
X11TimerManager *timerManager = X11TimerManager::Instance( p_intf );
timerManager->addTimer( refreshTimer );

View File

@ -2,7 +2,7 @@
* x11_window.cpp: X11 implementation of the Window class
*****************************************************************************
* 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>
*
@ -92,10 +92,33 @@ X11Window::X11Window( intf_thread_t *p_intf, Window wnd, int x, int y,
}
// Create Tool Tip window
ToolTipWindow = XCreateSimpleWindow( display, wnd, 0, 0, 1, 1, 0, 0, 0 );
X11Timer *timer = new X11Timer( p_intf, 100, ToolTipCallback, &ToolTipInfo );
ToolTipInfo.p_intf = p_intf;
ToolTipInfo.timer = timer;
XColor color;
color.red = 0xffff;
color.green = 0xffff;
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
ClickedX = 0;
@ -115,7 +138,7 @@ X11Window::~X11Window()
{
DestroyWindow( hWnd );
}*/
XDestroyWindow( display, ToolTipWindow );
XDestroyWindow( display, ToolTip.window );
/*
if( DragDrop )
{
@ -289,6 +312,10 @@ void X11Window::RefreshFromImage( int x, int y, int w, int h )
XImage *image = XGetImage( display, drawable, 0, 0, Width, Height,
AllPlanes, ZPixmap );
if( !image )
{
msg_Err( p_intf, "X11Window::RefreshFromImage failed");
}
// Mask for transparency
Region region = XCreateRegion();
@ -362,7 +389,31 @@ void X11Window::Size( int width, int height )
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;
}
@ -374,8 +425,14 @@ void X11Window::ChangeToolTipText( string text )
if( ToolTipText != "none" )
{
ToolTipText = "none";
// ToolTipInfo.lpszText = NULL;
// SendMessage( ToolTipWindow, TTM_ACTIVATE, 0 , 0 );
XLOCK;
// 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
@ -383,10 +440,10 @@ void X11Window::ChangeToolTipText( string text )
if( text != ToolTipText )
{
ToolTipText = text;
ToolTipInfo.text = text;
ToolTip.text = text;
OSAPI_GetMousePos( ToolTip.curX, ToolTip.curY );
X11TimerManager *timerManager = X11TimerManager::Instance( p_intf );
timerManager->addTimer( ToolTipInfo.timer );
// ToolTipInfo.lpszText = (char *)ToolTipText.c_str();
timerManager->addTimer( ToolTip.timer );
}
}
}

View File

@ -2,7 +2,7 @@
* x11_window.h: X11 implementation of the Window class
*****************************************************************************
* 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>
*
@ -41,6 +41,12 @@ typedef struct
intf_thread_t *p_intf;
X11Timer *timer;
string text;
Display *display;
Window window;
GC gc;
Font font;
int curX;
int curY;
} tooltip_t;
@ -62,8 +68,7 @@ class X11Window : public SkinWindow
X11DropObject *DropObject;
// Tooltip texts
Window ToolTipWindow;
tooltip_t ToolTipInfo;
tooltip_t ToolTip;
// Double-click handling
int ClickedX;