Index: src/Makefile.am =================================================================== RCS file: /cvsroot/toxine/toxine/src/Makefile.am,v retrieving revision 1.4 diff -u -r1.4 Makefile.am --- src/Makefile.am 1 Aug 2002 22:52:09 -0000 1.4 +++ src/Makefile.am 3 Aug 2002 16:46:36 -0000 @@ -14,7 +14,7 @@ GETOPT_H = getopt.h endif -COMMON_sources = utils.c parse.c xine_commands.c loader.c script.c playlist.c +COMMON_sources = utils.c parse.c xine_commands.c loader.c script.c playlist.c osdmenu.c toxine_SOURCES = $(GETOPT_C) main.c commands.c $(COMMON_sources) toxine_DEPENDENTIES = Index: src/commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.c,v retrieving revision 1.31 diff -u -r1.31 commands.c --- src/commands.c 1 Aug 2002 22:52:09 -0000 1.31 +++ src/commands.c 3 Aug 2002 16:46:45 -0000 @@ -135,6 +135,7 @@ static void do_display(commands_t *, toxine_t *, void *); static void do_mediamk(commands_t *, toxine_t *, void *); static void do_echo(commands_t *, toxine_t *, void *); +static void do_osd(commands_t *, toxine_t *, void *); static commands_t commands[] = { { "!", NO_ARGS, do_shell, @@ -341,6 +342,10 @@ "Display some version informations", "version" }, + { "osd", NO_ARGS, do_osd, + "Start osd menu", + "osd" + }, { "waitfor", REQUIRE_ARGS, do_waitfor, "Wait for an event.", "waitfor <[MOUSE_BUTTON | MOUSE_MOVE | SPU_BUTTON | SPU_CLUT |\n" @@ -1797,6 +1802,7 @@ } } + static void do_mediamk(commands_t *command, toxine_t *tox, void *data) { int nargs; @@ -2214,6 +2220,17 @@ } } +} + +#include "osdmenu.h" + +/* + * osd menu + */ +static void do_osd(commands_t *command, toxine_t *tox, void *data) { + CHECK_XINE(tox); + + osd_menu(tox); } static char *get_var(toxine_t *tox, char *var) { Index: src/common.h =================================================================== RCS file: /cvsroot/toxine/toxine/src/common.h,v retrieving revision 1.13 diff -u -r1.13 common.h --- src/common.h 1 Aug 2002 13:56:47 -0000 1.13 +++ src/common.h 3 Aug 2002 16:46:46 -0000 @@ -145,6 +145,8 @@ int plugins_num; toxine_vo_plugin_t *cur_plugin; pthread_t loop_thread; + + int width,height; } video; struct { Index: src/osdmenu.c =================================================================== RCS file: src/osdmenu.c diff -N src/osdmenu.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/osdmenu.c 3 Aug 2002 16:46:49 -0000 @@ -0,0 +1,765 @@ +/* +** Copyright (C) 2002 Daniel Caujolle-Bert +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "tilde.h" + +#include "common.h" +#include "utils.h" +#include "commands.h" +#include "xine_commands.h" +#include "playlist.h" + +#include "osdmenu.h" + +static clut_t textpalettes_color[] = { + /* white, no border, translucid */ + CLUT_Y_CR_CB_INIT(0x00, 0x00, 0x00), //0 + CLUT_Y_CR_CB_INIT(0x60, 0x80, 0x80), //1 + CLUT_Y_CR_CB_INIT(0x70, 0x80, 0x80), //2 + CLUT_Y_CR_CB_INIT(0x80, 0x80, 0x80), //3 + CLUT_Y_CR_CB_INIT(0x80, 0x80, 0x80), //4 + CLUT_Y_CR_CB_INIT(0x80, 0x80, 0x80), //5 + CLUT_Y_CR_CB_INIT(0x80, 0x80, 0x80), //6 + CLUT_Y_CR_CB_INIT(0xa0, 0x80, 0x80), //7 + CLUT_Y_CR_CB_INIT(0xc0, 0x80, 0x80), //8 + CLUT_Y_CR_CB_INIT(0xe0, 0x80, 0x80), //9 + CLUT_Y_CR_CB_INIT(0xff, 0x80, 0x80), //10 + /* yellow, black border, transparent */ + CLUT_Y_CR_CB_INIT(0x00, 0x00, 0x00), //0 + CLUT_Y_CR_CB_INIT(0x80, 0x80, 0xe0), //1 + CLUT_Y_CR_CB_INIT(0x80, 0x80, 0xc0), //2 + CLUT_Y_CR_CB_INIT(0x60, 0x80, 0xa0), //3 + CLUT_Y_CR_CB_INIT(0x40, 0x80, 0x80), //4 + CLUT_Y_CR_CB_INIT(0x20, 0x80, 0x80), //5 + CLUT_Y_CR_CB_INIT(0x00, 0x80, 0x80), //6 + CLUT_Y_CR_CB_INIT(0x40, 0x84, 0x60), //7 + CLUT_Y_CR_CB_INIT(0xd0, 0x88, 0x40), //8 + CLUT_Y_CR_CB_INIT(0xe0, 0x8a, 0x00), //9 + CLUT_Y_CR_CB_INIT(0xff, 0x90, 0x00), //10 +}; + +static uint8_t textpalettes_trans[] = { + /* white, no border, translucid */ + 0, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, + /* yellow, black border, transparent */ + 0, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, +}; + +#define TEXT_GAP 5 + +static toxine_t *tox; +static osd_renderer_t *renderer; + +static struct termios orig, new; +static void set_raw_kbd(void) +{ + tcgetattr(0, &orig); + new = orig; + new.c_lflag &= ~ICANON; + new.c_lflag &= ~ECHO; + new.c_lflag &= ~ISIG; + new.c_cc[VMIN] = 0; + new.c_cc[VTIME] = 0; + tcsetattr(0, TCSANOW, &new); +} + +static void restore_kbd(void) +{ + tcsetattr(0,TCSANOW, &orig); +} + +static int getkey() +{ + char ch; + int nread; + nread = read(0,&ch,1); + if( !nread ) + return 0; + else + return ch; +} + +static void menu_add_entry( menu_t *menu, char *text, int font, + entry_func_t action, void *usr ) { + entry_t *entry, *cur; + + entry = malloc(sizeof(entry_t)); + entry->text = strdup(text); + entry->font = font; + entry->action = action; + entry->usr = usr; + entry->next = NULL; + + if( !menu->entries ) { + menu->entries = entry; + } else { + cur = menu->entries; + while( cur->next ) + cur = cur->next; + cur->next = entry; + } + + if( font == FONT_NORMAL ) + menu->num_options++; +} + +static void menu_calculate_size( menu_t *menu, int *width, int *height ) { + int line_width, line_height; + entry_t *entry; + + entry = menu->entries; + *width = 0; + *height = TEXT_GAP; + while( entry ) { + renderer->set_font( menu->osd, menu->fonts[entry->font].name, + menu->fonts[entry->font].size ); + + renderer->get_text_size( menu->osd, entry->text, &line_width, &line_height ); + + *height += line_height + TEXT_GAP; + if( line_width > *width ) + *width = line_width; + + entry = entry->next; + } + *width += 2*TEXT_GAP; +} + +static void menu_draw( menu_t *menu ) { + + int width, height; + int y, index; + entry_t *entry; + + renderer->filled_rect(menu->osd, + menu->x1, menu->y1, + menu->x2, menu->y2, + menu->fonts[FONT_NORMAL].color_base+1 ); + entry = menu->entries; + y = menu->y1 + TEXT_GAP; + index = 0; + while( entry ) { + int font; + char *text; + int too_big; + + if( entry->font == FONT_NORMAL ) + font = (index == menu->index) ? FONT_SELECTED : FONT_NORMAL; + else + font = entry->font; + + renderer->set_font( menu->osd, menu->fonts[font].name, + menu->fonts[font].size ); + + text = NULL; + do { + renderer->get_text_size( menu->osd, (!text)?entry->text:text, &width, &height ); + + if( y + height + TEXT_GAP > menu->y2 ) + break; + + if( width + 2*TEXT_GAP > menu->x2 - menu->x1 ) { + if( !text ) + text = strdup(entry->text); + text[ strlen(text)-1 ] = '\0'; + too_big = 1; + } + else + too_big = 0; + } while(too_big); + + if( y + height + TEXT_GAP > menu->y2 ) + break; + + if( (!index && font == FONT_HEADER) || + index >= menu->screen_first_index ) { + renderer->filled_rect(menu->osd, + menu->x1, y, + menu->x2, y + height+2, + menu->fonts[font].color_base+1 ); + + renderer->render_text( menu->osd, ((menu->x2 - menu->x1) - width)/2 + menu->x1, + y+1, (!text)?entry->text:text, + menu->fonts[font].color_base ); + y += height + TEXT_GAP; + menu->screen_last_index = index; + } + + if( entry->font == FONT_NORMAL ) + index++; + + entry = entry->next; + + if( text ) + free(text); + } + + renderer->show(menu->osd,0); +} + +static void menu_hide( menu_t *menu ) +{ + renderer->hide(menu->osd,0); +} + +static int menu_action( menu_t *menu, int key ) +{ + int index; + entry_t *entry; + + entry = menu->entries; + index = 0; + while( entry ) { + if( entry->font == FONT_NORMAL && index == menu->index && + entry->action != NULL ) { + return entry->action(menu, entry->usr, entry->text, key ); + } + + if( entry->font == FONT_NORMAL ) + index++; + + entry = entry->next; + } + return 0; +} + +static int menu_control( menu_t *menu, int status ) +{ + int c; + int ret = 1; + + do { + menu_draw( menu ); + + do { + xine_usec_sleep(10000); + c = getkey(); + } while( !c && xine_get_status(tox->xine) == status ); + + if( c == KEY_DOWN ) { + if( menu->index < menu->num_options-1 ) { + menu->index++; + + while( menu->index > menu->screen_last_index ) { + menu->screen_first_index++; + menu_draw(menu); + } + } + } + + if( c == KEY_UP ) { + if( menu->index ) { + menu->index--; + + if( menu->index < menu->screen_first_index ) + menu->screen_first_index = menu->index; + } + } + + if( c == KEY_ENTER || c == KEY_PLUS || c == KEY_MINUS ) { + if( (ret = menu_action( menu, c )) != 0 ) + break; + } + + if( c == KEY_QUIT ) { + ret = 0; + break; + } + + if( xine_get_status(tox->xine) != status ) { + ret = -1; + break; + } + } while( 1 ); + menu_hide( menu ); + return ret; +} + +static menu_t *menu_alloc_default(void) +{ + menu_t *menu; + menu = malloc(sizeof(menu_t)); + memset( menu, 0, sizeof(menu_t) ); + + menu->osd = renderer->new_object(renderer, + tox->video.width,tox->video.height); + + menu->fonts[FONT_HEADER].name = strdup("sans"); + menu->fonts[FONT_HEADER].size = 24; + menu->fonts[FONT_HEADER].color_base = OSD_TEXT1; + + menu->fonts[FONT_NORMAL].name = strdup("sans"); + menu->fonts[FONT_NORMAL].size = 20; + menu->fonts[FONT_NORMAL].color_base = OSD_TEXT1; + + menu->fonts[FONT_SELECTED].name = strdup("sans"); + menu->fonts[FONT_SELECTED].size = 20; + menu->fonts[FONT_SELECTED].color_base = OSD_TEXT2; + + memcpy(menu->color, textpalettes_color, sizeof(textpalettes_color) ); + memcpy(menu->trans, textpalettes_trans, sizeof(textpalettes_trans) ); + renderer->set_palette(menu->osd, menu->color, menu->trans); + + menu->entries = NULL; + menu->index = 0; + menu->screen_first_index = 0; + menu->num_options = 0; + + return menu; +} + +static void menu_free(menu_t *menu) +{ + entry_t *entry, *last; + + renderer->free_object(menu->osd); + + free(menu->fonts[FONT_HEADER].name); + free(menu->fonts[FONT_NORMAL].name); + free(menu->fonts[FONT_SELECTED].name); + + entry = menu->entries; + while( entry ) { + free(entry->text); + last = entry; + entry = entry->next; + free(last); + } + + free(menu); +} + +static void menu_center_by_border( menu_t *menu, int border ) { + menu->x1 = border; + menu->y1 = border; + menu->x2 = tox->video.width - border; + menu->y2 = tox->video.height - border; +} + +static void menu_center_by_size( menu_t *menu ) { + int width, height; + + menu_calculate_size( menu, &width, &height ); + menu->x1 = (tox->video.width - width) / 2; + menu->y1 = (tox->video.height - height) / 2; + menu->x2 = menu->x1 + width; + menu->y2 = menu->y1 + height; +} + + +int action_select_dir(menu_t *parent, void *usr, char *text, int key) +{ + int i; + char *origin = usr; + + if( key != KEY_ENTER ) + return 0; + + i = strlen(text)-1; + if( text[i] == '/' ) + i--; + + if( text[i] == '.' && i == 0 ) + return 1; + + if( text[i] == '.' && text[i-1] == '.' ) { + int j; + + j = strlen(origin)-1; + if( !j ) + return 1; + if( origin[j] == '/' ) + j--; + while( j >= 0 && origin[j] != '/' ) + j--; + origin[j+1] = '\0'; + return 1; + } + + strcat(origin,text); + return 1; +} + +int action_select_file(menu_t *parent, void *usr, char *text, int key) +{ + char *origin = usr; + char mrl[PATH_MAX]; + + if( key != KEY_ENTER ) + return 0; + + strcpy(mrl,origin); + if(strlen(mrl) && mrl[strlen(mrl)-1] != '/') + strcat(mrl,"/"); + strcat(mrl,text); + + if(tox->current_mrl) + free(tox->current_mrl); + tox->current_mrl = strdup(mrl); + + if(!xine_play(tox->xine, mrl, 0, 0)) + return 0; + else + return 2; +} + +int action_browse_files(menu_t *parent, void *usr, char *text, int key) +{ + char origin[PATH_MAX]; + mrl_t **bmrls; + int mrls, i; + menu_t *menu; + int ret; + + if( key != KEY_ENTER ) + return 0; + + menu_hide(parent); + origin[0] = '\0'; + + do { + menu = menu_alloc_default(); + menu_center_by_border( menu, 20 ); + + bmrls = xine_get_browse_mrls(tox->xine, "file", strlen(origin)?origin:NULL, &mrls); + if(bmrls) { + for(i = 0; i < mrls; i++) { + mrl_t *mrl = bmrls[i]; + + if( !i ) { + int j; + strcpy(origin,mrl->mrl); + j = strlen(origin)-1; + if( origin[j] == '/' ) + j--; + while( j >= 0 && origin[j] != '/' ) + j--; + origin[j+1] = '\0'; + + menu_add_entry( menu, origin, FONT_HEADER, NULL, NULL ); + menu_add_entry( menu, " ", FONT_HEADER, NULL, NULL ); + } + + if(mrl->type & mrl_file_directory) { + char tmp[PATH_MAX]; + + strcpy(tmp,mrl->mrl+strlen(origin)); + strcat(tmp,"/"); + menu_add_entry( menu, tmp, FONT_NORMAL, + action_select_dir, (void *)origin ); + } + else + menu_add_entry( menu, mrl->mrl+strlen(origin), FONT_NORMAL, + action_select_file, (void *)origin ); + } + } + ret = menu_control( menu, XINE_STOP ); + menu_free(menu); + }while(ret == 1); + + return 0; +} + +int action_autoplay_plugin(menu_t *parent, void *usr, char *text, int key) +{ + char **ap; + int i, mrls; + + if( key != KEY_ENTER ) + return 0; + + menu_hide(parent); + + ap = xine_get_autoplay_mrls(tox->xine, text, &mrls); + if(ap && mrls) { + + for(i = 0; i < mrls; i++) + playlist_add_entry(tox, ap[i], NULL, 0, -1); + + if(tox->playlist.num && (tox->playlist.cur == -1)) { + tox->playlist.cur = 0; + toxine_set_current_mrl_from_cur(tox); + } + } + _xine_play(NULL, tox, (void *)NO_ARGS); + + return 1; +} + +int action_select_source(menu_t *parent, void *usr, char *text, int key) +{ + char **inpp; + menu_t *menu; + int ret = 0; + int i = 0; + + if( key != KEY_ENTER ) + return 0; + + menu_hide(parent); + + menu = menu_alloc_default(); + menu_add_entry( menu, "select source", FONT_HEADER, NULL, NULL ); + menu_add_entry( menu, " ", FONT_HEADER, NULL, NULL ); + + inpp = xine_get_autoplay_input_plugin_ids(tox->xine); + + if(inpp) { + while(inpp[i] != NULL) { + menu_add_entry( menu, inpp[i], FONT_NORMAL, action_autoplay_plugin, NULL ); + i++; + } + menu_center_by_size( menu ); + ret = menu_control( menu, XINE_STOP ); + } + menu_free( menu ); + + return ret; +} + +static void control_volume(void) +{ + osd_object_t *osd; + int osd_width,osd_height; + int width, height; + char *text; + unsigned long timeout, acctime, sleeptime; + int c; + int bar_y, bar_height; + int bar_x, bar_width; + + osd_width = 120; + osd_height = 60; + bar_y = 25; + bar_height = 20; + bar_x = 10; + bar_width = 100; + + osd = renderer->new_object(renderer,osd_width, osd_height); + renderer->set_position(osd, (tox->video.width - osd_width) / 2, + (tox->video.height - osd_height) / 2); + + renderer->set_font (osd, "sans", 16); + renderer->set_text_palette (osd, TEXTPALETTE_WHITE_BLACK_TRANSPARENT, OSD_TEXT1 ); + + if(tox->audio.mixer.enable) { + text = "audio volume"; + + renderer->get_text_size( osd, text, &width, &height ); + renderer->render_text( osd, (osd_width - width)/2, + 0, text, OSD_TEXT1 ); + + timeout = 2000000; + sleeptime = 10000; + do{ + tox->audio.mixer.volume_level = xine_get_audio_property(tox->xine, tox->audio.mixer.volume_mixer); + renderer->filled_rect(osd, + bar_x-3, bar_y-3, + bar_x+bar_width+3, bar_y+bar_height+3, + OSD_TEXT1+6 ); + renderer->filled_rect(osd, + bar_x-2, bar_y-2, + bar_x+bar_width+2, bar_y+bar_height+2, + OSD_TEXT1+10 ); + renderer->filled_rect(osd, + bar_x+tox->audio.mixer.volume_level, bar_y, + bar_x+bar_width, bar_y+bar_height, + OSD_TEXT1+6 ); + renderer->show(osd,0); + + acctime = 0; + do{ + xine_usec_sleep(sleeptime); + acctime += sleeptime; + c = getkey(); + + if( c ) { + if( c == KEY_PLUS ) + tox->audio.mixer.volume_level++; + if( c == KEY_MINUS ) + tox->audio.mixer.volume_level--; + + if(tox->audio.mixer.volume_level < 0) + tox->audio.mixer.volume_level = 0; + else if(tox->audio.mixer.volume_level > 100) + tox->audio.mixer.volume_level = 100; + + xine_set_audio_property(tox->xine, tox->audio.mixer.volume_mixer, + tox->audio.mixer.volume_level); + } + }while( !c && acctime < timeout ); + + }while( acctime < timeout ); + } + else { + text = "Mixer disabled!"; + + renderer->get_text_size( osd, text, &width, &height ); + renderer->render_text( osd, (osd_width - width)/2, + (osd_height - height)/2, text, OSD_TEXT1 ); + renderer->show(osd,0); + sleep(2); + } + renderer->free_object(osd); +} + + +int action_control_volume(menu_t *parent, void *usr, char *text, int key) +{ + if( key != KEY_ENTER ) + return 0; + + menu_hide(parent); + control_volume(); + return 0; +} + +int control_main_menu(void) +{ + menu_t *menu; + int ret; + + menu = menu_alloc_default(); + + menu_center_by_border( menu, 20 ); + + menu_add_entry( menu, "osd menu", FONT_HEADER, NULL, NULL ); + menu_add_entry( menu, " ", FONT_HEADER, NULL, NULL ); + menu_add_entry( menu, "play file", FONT_NORMAL, action_browse_files, NULL ); + menu_add_entry( menu, "select source", FONT_NORMAL, action_select_source, NULL ); + menu_add_entry( menu, "image control", FONT_NORMAL, NULL, NULL ); + menu_add_entry( menu, "audio volume", FONT_NORMAL, action_control_volume, NULL ); + menu_add_entry( menu, "quit", FONT_NORMAL, NULL, NULL ); + + ret = menu_control( menu, XINE_STOP ); + menu_free( menu ); + + return ret; +} + +int action_stop(menu_t *parent, void *usr, char *text, int key) +{ + if( key != KEY_ENTER ) + return 0; + + menu_hide(parent); + xine_stop(tox->xine); + sleep(1); + return 1; +} + +int action_fullscreen(menu_t *parent, void *usr, char *text, int key) +{ + if( key != KEY_ENTER ) + return 0; + + tox->video.cur_plugin->fullscreen(tox); + + return 1; +} + +int action_deinterlace(menu_t *parent, void *usr, char *text, int key) +{ + int property = VO_PROP_INTERLACED; + + if( key != KEY_ENTER ) + return 0; + + tox->video.cur_plugin->set_property(tox, property, + 1-tox->video.cur_plugin->get_property(tox, property)); + + return 1; +} + + +int control_playing_menu(void) +{ + menu_t *menu; + int ret; + + menu = menu_alloc_default(); + + menu_add_entry( menu, "stop", FONT_NORMAL, action_stop, NULL ); + menu_add_entry( menu, "fullscreen", FONT_NORMAL, action_fullscreen, NULL ); + menu_add_entry( menu, "deinterlace", FONT_NORMAL, action_deinterlace, NULL ); + menu_add_entry( menu, "volume", FONT_NORMAL, action_control_volume, NULL ); + menu_add_entry( menu, "image", FONT_NORMAL, NULL, NULL ); + + menu_center_by_size(menu); + + ret = menu_control( menu, XINE_PLAY ); + menu_free( menu ); + + return ret; +} + +void osd_menu(toxine_t *toxine) +{ + int c; + + tox = toxine; + renderer = xine_get_osd_renderer (tox->xine); + + set_raw_kbd(); + + do{ + if( xine_get_status(tox->xine) == XINE_STOP ) { + if( !control_main_menu() ) + break; + } else { + xine_usec_sleep(10000); + c = getkey(); + + if( c == KEY_QUIT ) { + xine_stop(tox->xine); + break; + } + + if( c == KEY_PLUS || c == KEY_MINUS ) { + control_volume(); + } + + if( c == KEY_ENTER ) { + xine_set_speed(tox->xine, SPEED_PAUSE); + control_playing_menu(); + xine_set_speed(tox->xine, SPEED_NORMAL); + } + } + }while(1); + restore_kbd(); +} Index: src/osdmenu.h =================================================================== RCS file: src/osdmenu.h diff -N src/osdmenu.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/osdmenu.h 3 Aug 2002 16:46:50 -0000 @@ -0,0 +1,62 @@ +typedef struct { /* CLUT == Color LookUp Table */ + uint8_t cb : 8; + uint8_t cr : 8; + uint8_t y : 8; + uint8_t foo : 8; +} __attribute__ ((packed)) clut_t; + +#ifdef __GNUC__ +#define CLUT_Y_CR_CB_INIT(_y,_cr,_cb) {y: (_y), cr: (_cr), cb: (_cb)} +#else +#define CLUT_Y_CR_CB_INIT(_y,_cr,_cb) { (_cb), (_cr), (_y) } +#endif + +typedef struct { + char *name; + int size; + int color_base; +} font_t; + +#define FONT_HEADER 0 +#define FONT_NORMAL 1 +#define FONT_SELECTED 2 + +typedef struct menu_s menu_t; + +typedef int (*entry_func_t) (menu_t *menu, void *usr, char *text, int key); + +#define KEY_ENTER '5' +#define KEY_PLUS '6' +#define KEY_MINUS '4' +#define KEY_UP '8' +#define KEY_DOWN '2' +#define KEY_QUIT 'q' + +typedef struct entry_s { + char *text; + int font; + entry_func_t action; + void *usr; + struct entry_s *next; +} entry_t; + +struct menu_s { + int x1, y1; + int x2, y2; + + osd_object_t *osd; + + font_t fonts[3]; + uint32_t color[OVL_PALETTE_SIZE]; + uint8_t trans[OVL_PALETTE_SIZE]; + + entry_t *entries; + int index; + int num_options; + + int screen_first_index; + int screen_last_index; +}; + + +void osd_menu(toxine_t *tox); Index: src/plugins/vo_x11.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/plugins/vo_x11.c,v retrieving revision 1.14 diff -u -r1.14 vo_x11.c --- src/plugins/vo_x11.c 25 Jul 2002 13:47:29 -0000 1.14 +++ src/plugins/vo_x11.c 3 Aug 2002 16:46:55 -0000 @@ -415,6 +415,9 @@ *dest_x = 0; *dest_y = 0; + tox->video.width = video_width; + tox->video.height = video_height; + if(!private->fullscreen) { private->x11_drawable[private->fullscreen].video_width = video_width; private->x11_drawable[private->fullscreen].video_height = video_height;