Commit 0cc94ad3 authored by smorlat's avatar smorlat

set icon and title on video window too.



git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@216 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent 13c66482
......@@ -2034,6 +2034,14 @@ const char *linphone_core_get_video_device(const LinphoneCore *lc){
return NULL;
}
unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc){
if (lc->videostream)
return video_stream_get_native_window_id(lc->videostream);
if (lc->previewstream)
return video_stream_get_native_window_id(lc->previewstream);
return 0;
}
static MSVideoSizeDef supported_resolutions[]={
{ MS_VIDEO_SIZE_SVGA , "svga" },
{ MS_VIDEO_SIZE_4CIF , "4cif" },
......
......@@ -702,7 +702,8 @@ const char** linphone_core_get_video_devices(const LinphoneCore *lc);
int linphone_core_set_video_device(LinphoneCore *lc, const char *id);
const char *linphone_core_get_video_device(const LinphoneCore *lc);
/*function to be used for eventually setting window decorations (icons, title...)*/
unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc);
/*play/record support: use files instead of soundcard*/
......
......@@ -246,8 +246,39 @@ void linphone_gtk_show_about(){
gtk_widget_show(about);
}
static void set_video_window_decorations(GdkWindow *w){
const char *title=linphone_gtk_get_ui_config("title","Linphone");
const char *icon_path=linphone_gtk_get_ui_config("icon","linphone2.png");
char video_title[256];
GdkPixbuf *pbuf=create_pixbuf(icon_path);
snprintf(video_title,sizeof(video_title),"%s video",title);
gdk_window_set_title(w,video_title);
if (pbuf){
GList *l=NULL;
l=g_list_append(l,pbuf);
gdk_window_set_icon_list(w,l);
g_list_free(l);
g_object_unref(G_OBJECT(pbuf));
}
}
static gboolean linphone_gtk_iterate(LinphoneCore *lc){
unsigned long id;
static unsigned long previd=0;
linphone_core_iterate(lc);
id=linphone_core_get_native_video_window_id(lc);
if (id!=previd){
GdkWindow *w;
previd=id;
if (id!=0){
w=gdk_window_foreign_new(id);
if (w) {
set_video_window_decorations(w);
g_object_unref(G_OBJECT(w));
}
else ms_error("gdk_window_foreign_new() failed");
}
}
return TRUE;
}
......@@ -693,18 +724,21 @@ static void linphone_gtk_check_menu_items(void){
static void linphone_gtk_configure_main_window(){
static gboolean config_loaded=FALSE;
static gboolean show_digits=1;
static gboolean show_identities=1;
static const char *title;
static const char *home;
static const char *icon_path;
GtkWidget *w=linphone_gtk_get_main_window();
if (!config_loaded){
show_digits=linphone_gtk_get_ui_config_int("show_digits",1);
show_identities=linphone_gtk_get_ui_config_int("identity_frame",1);
title=linphone_gtk_get_ui_config("title",NULL);
home=linphone_gtk_get_ui_config("home","http://www.linphone.org");
icon_path=linphone_gtk_get_ui_config("icon",NULL);
config_loaded=TRUE;
}
if (show_digits==0) gtk_widget_hide(linphone_gtk_get_widget(w,"dialpad"));
if (show_digits==FALSE) gtk_widget_hide(linphone_gtk_get_widget(w,"dialpad"));
if (show_identities==FALSE) gtk_widget_hide(linphone_gtk_get_widget(w,"identity_frame"));
if (title) gtk_window_set_title(GTK_WINDOW(w),title);
if (icon_path) {
GdkPixbuf *pbuf=create_pixbuf(icon_path);
......
This diff is collapsed.
......@@ -142,6 +142,8 @@ void video_stream_send_vfu(VideoStream *stream);
void video_stream_stop(VideoStream * stream);
void video_stream_set_sent_video_size(VideoStream *stream, MSVideoSize vsize);
void video_stream_enable_self_view(VideoStream *stream, bool_t val);
unsigned long video_stream_get_native_window_id(VideoStream *stream);
VideoStream * video_preview_start(MSWebCam *device, MSVideoSize vsize);
void video_preview_stop(VideoStream *stream);
......
......@@ -52,6 +52,7 @@ typedef struct _MSDisplay{
MSDisplayDesc *desc;
long window_id; /*window id if the display should use an existing window*/
void *data;
bool_t use_external_window;
} MSDisplay;
......@@ -94,6 +95,7 @@ void ms_display_destroy(MSDisplay *d);
#define MS_VIDEO_OUT_SET_CORNER MS_FILTER_METHOD(MS_VIDEO_OUT_ID,2,int)
#define MS_VIDEO_OUT_AUTO_FIT MS_FILTER_METHOD(MS_VIDEO_OUT_ID,3,int)
#define MS_VIDEO_OUT_ENABLE_MIRRORING MS_FILTER_METHOD(MS_VIDEO_OUT_ID,4,int)
#define MS_VIDEO_OUT_GET_NATIVE_WINDOW_ID MS_FILTER_METHOD(MS_VIDEO_OUT_ID,5,unsigned long)
#ifdef __cplusplus
}
......
......@@ -53,6 +53,17 @@ static SDL_Surface *sdl_screen=0;
#include <SDL/SDL_syswm.h>
static long sdl_get_native_window_id(){
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
if ( SDL_GetWMInfo(&info) ) {
if ( info.subsystem == SDL_SYSWM_X11 ) {
return (long) info.info.x11.wmwindow;
}
}
return 0;
}
static void sdl_show_window(bool_t show){
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
......@@ -79,6 +90,11 @@ static void sdl_show_window(bool_t show){
ms_warning("SDL window show/hide not implemented");
}
static long sdl_get_native_window_id(){
ms_warning("sdl_get_native_window_id not implemented");
return 0;
}
#endif
static void sdl_display_uninit(MSDisplay *obj);
......@@ -92,7 +108,7 @@ static SDL_Overlay * sdl_create_window(int w, int h){
return NULL;
}
if (sdl_screen->flags & SDL_HWSURFACE) ms_message("SDL surface created in hardware");
SDL_WM_SetCaption("Linphone Video", NULL);
SDL_WM_SetCaption("Video window", NULL);
ms_message("Using yuv overlay.");
lay=SDL_CreateYUVOverlay(w , h ,SDL_YV12_OVERLAY,sdl_screen);
if (lay==NULL){
......@@ -137,6 +153,7 @@ static bool_t sdl_display_init(MSDisplay *obj, MSPicture *fbuf){
fbuf->h=lay->h;
obj->data=lay;
sdl_show_window(TRUE);
obj->window_id=sdl_get_native_window_id();
return TRUE;
}
return FALSE;
......@@ -207,7 +224,7 @@ MSDisplayDesc ms_sdl_display_desc={
.unlock=sdl_display_unlock,
.update=sdl_display_update,
.uninit=sdl_display_uninit,
.pollevent=sdl_poll_event
.pollevent=sdl_poll_event,
};
#elif defined(WIN32)
......@@ -325,7 +342,7 @@ static bool_t win_display_init(MSDisplay *obj, MSPicture *fbuf){
wd->fb.h=fbuf->h;
if (wd->window==NULL){
if (obj->window_id!=0){
if (obj->use_external_window && obj->window_id!=0){
void *p;
wd->window=(HWND)obj->window_id;
p=(void*)GetWindowLongPtr(wd->window,GWLP_USERDATA);
......@@ -335,10 +352,11 @@ static bool_t win_display_init(MSDisplay *obj, MSPicture *fbuf){
}else SetWindowLongPtr(wd->window,GWLP_USERDATA,(LONG_PTR)obj);
}else{
wd->window=create_window(wd->fb.w,wd->fb.h);
obj->window_id=wd->window;
if (wd->window!=NULL) SetWindowLongPtr(wd->window,GWLP_USERDATA,(LONG_PTR)obj);
else return FALSE;
}
}else if (obj->window_id==0){
}else if (!obj->use_external_window){
/* the window might need to be resized*/
RECT cur;
GetWindowRect(wd->window,&cur);
......@@ -488,6 +506,7 @@ MSDisplay *ms_display_new(MSDisplayDesc *desc){
void ms_display_set_window_id(MSDisplay *d, long id){
d->window_id=id;
d->use_external_window=TRUE;
}
void ms_display_destroy(MSDisplay *obj){
......@@ -827,6 +846,17 @@ static int video_out_enable_mirroring(MSFilter *f,void *arg){
return 0;
}
static int video_out_get_native_window_id(MSFilter *f, void*arg){
VideoOut *s=(VideoOut*)f->data;
unsigned long *id=(unsigned long*)arg;
*id=0;
if (s->display){
*id=s->display->window_id;
return 0;
}
return -1;
}
static MSFilterMethod methods[]={
{ MS_FILTER_SET_VIDEO_SIZE , video_out_set_vsize },
{ MS_VIDEO_OUT_SET_DISPLAY , video_out_set_display},
......@@ -834,6 +864,7 @@ static MSFilterMethod methods[]={
{ MS_VIDEO_OUT_AUTO_FIT , video_out_auto_fit},
{ MS_VIDEO_OUT_HANDLE_RESIZING , video_out_handle_resizing},
{ MS_VIDEO_OUT_ENABLE_MIRRORING , video_out_enable_mirroring},
{ MS_VIDEO_OUT_GET_NATIVE_WINDOW_ID, video_out_get_native_window_id},
{ 0 ,NULL}
};
......
......@@ -345,6 +345,14 @@ void video_stream_set_rtcp_information(VideoStream *st, const char *cname, const
}
}
unsigned long video_stream_get_native_window_id(VideoStream *stream){
unsigned long id;
if (stream->output){
if (ms_filter_call_method(stream->output,MS_VIDEO_OUT_GET_NATIVE_WINDOW_ID,&id)==0)
return id;
}
return 0;
}
VideoStream * video_preview_start(MSWebCam *device, MSVideoSize disp_size){
......
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