Index: /pjproject/trunk/pjmedia/include/pjmedia-videodev/videodev.h
===================================================================
--- /pjproject/trunk/pjmedia/include/pjmedia-videodev/videodev.h	(revision 3863)
+++ /pjproject/trunk/pjmedia/include/pjmedia-videodev/videodev.h	(revision 3864)
@@ -112,4 +112,22 @@
 
 /**
+ * Enumeration of window flags.
+ */
+typedef enum pjmedia_vid_dev_wnd_flag
+{
+    /**
+     * Window with border.
+     */
+    PJMEDIA_VID_DEV_WND_BORDER = 1,
+
+    /**
+     * Window can be resized.
+     */
+    PJMEDIA_VID_DEV_WND_RESIZABLE = 2
+
+} pjmedia_vid_dev_wnd_flag;
+
+
+/**
  * Device index constants.
  */
@@ -238,4 +256,11 @@
      */
     PJMEDIA_VID_DEV_CAP_SWITCH = 256,
+
+    /**
+     * Support for setting the output video window's flags.
+     * The value of this capability is a bitmask combination of
+     * #pjmedia_vid_dev_wnd_flag.
+     */
+    PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS = 512,
 
     /**
@@ -422,4 +447,10 @@
     pjmedia_orient orient;
 
+    /**
+     * Video window flags. This setting is optional, and will only be used
+     * if PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS is set in the flags.
+     */
+    unsigned window_flags;
+
 } pjmedia_vid_dev_param;
 
Index: /pjproject/trunk/pjmedia/src/pjmedia-videodev/sdl_dev.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia-videodev/sdl_dev.c	(revision 3863)
+++ /pjproject/trunk/pjmedia/src/pjmedia-videodev/sdl_dev.c	(revision 3864)
@@ -494,4 +494,5 @@
                          PJMEDIA_VID_DEV_CAP_OUTPUT_RESIZE;
         ddi->info.caps |= PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW;
+        ddi->info.caps |= PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS;
 
         for (j = 0; j < ddi->info.fmt_cnt; j++) {
@@ -700,5 +701,14 @@
 
     if (!strm->window) {
-        Uint32 flags = /*SDL_WINDOW_RESIZABLE; */ SDL_WINDOW_BORDERLESS;
+        Uint32 flags = 0;
+        
+        if (strm->param.flags & PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS) {
+            if (!(strm->param.window_flags & PJMEDIA_VID_DEV_WND_BORDER))
+                flags |= SDL_WINDOW_BORDERLESS;
+            if (strm->param.window_flags & PJMEDIA_VID_DEV_WND_RESIZABLE)
+                flags |= SDL_WINDOW_RESIZABLE;
+        } else {
+            flags |= SDL_WINDOW_BORDERLESS;
+        }
 
         if (!((strm->param.flags & PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE) &&
@@ -971,4 +981,9 @@
     {
 	pi->flags |= PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE;
+    }
+    if (sdl_stream_get_cap(s, PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS,
+			   &pi->window_flags) == PJ_SUCCESS)
+    {
+	pi->flags |= PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS;
     }
 
@@ -1038,5 +1053,13 @@
     } else if (cap == PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE) {
 	Uint32 flag = SDL_GetWindowFlags(strm->window);
-	*((pj_bool_t *)pval) = (flag | SDL_WINDOW_HIDDEN)? PJ_TRUE: PJ_FALSE;
+	*((pj_bool_t *)pval) = (flag & SDL_WINDOW_HIDDEN)? PJ_TRUE: PJ_FALSE;
+	return PJ_SUCCESS;
+    } else if (cap == PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS) {
+	Uint32 flag = SDL_GetWindowFlags(strm->window);
+        unsigned *wnd_flags = (unsigned *)pval;
+        if (!(flag & SDL_WINDOW_BORDERLESS))
+            *wnd_flags |= PJMEDIA_VID_DEV_WND_BORDER;
+        if (flag & SDL_WINDOW_RESIZABLE)
+            *wnd_flags |= PJMEDIA_VID_DEV_WND_RESIZABLE;
 	return PJ_SUCCESS;
     }
Index: /pjproject/trunk/pjmedia/src/pjmedia-videodev/videodev.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia-videodev/videodev.c	(revision 3863)
+++ /pjproject/trunk/pjmedia/src/pjmedia-videodev/videodev.c	(revision 3864)
@@ -47,5 +47,6 @@
     DEFINE_CAP("preview",       "Input preview"),
     DEFINE_CAP("orientation",   "Video orientation"),
-    DEFINE_CAP("switch",        "Switch device")
+    DEFINE_CAP("switch",        "Switch device"),
+    DEFINE_CAP("wndflags",      "Window flags")
 };
 
@@ -189,4 +190,7 @@
      * to switch immediately).
      */
+    case PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS:
+	FIELD_INFO(window_flags);
+	break;
     default:
 	return PJMEDIA_EVID_INVCAP;
Index: /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 3863)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 3864)
@@ -3867,4 +3867,9 @@
     acc_cfg->vid_in_auto_show = app_config.vid.in_auto_show;
     acc_cfg->vid_out_auto_transmit = app_config.vid.out_auto_transmit;
+    /* Note that normally GUI application will prefer a borderless
+     * window.
+     */
+    acc_cfg->vid_wnd_flags = PJMEDIA_VID_DEV_WND_BORDER |
+                             PJMEDIA_VID_DEV_WND_RESIZABLE;
     acc_cfg->vid_cap_dev = app_config.vid.vcapture_dev;
     acc_cfg->vid_rend_dev = app_config.vid.vrender_dev;
@@ -4022,5 +4027,10 @@
 		int dev_id = atoi(argv[4]);
 		if (on) {
-		    pjsua_vid_preview_start(dev_id, NULL);
+                    pjsua_vid_preview_param param;
+
+                    pjsua_vid_preview_param_default(&param);
+                    param.wnd_flags = PJMEDIA_VID_DEV_WND_BORDER |
+                                      PJMEDIA_VID_DEV_WND_RESIZABLE;
+		    pjsua_vid_preview_start(dev_id, &param);
 		    arrange_window(pjsua_vid_preview_get_win(dev_id));
 		} else {
Index: /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 3863)
+++ /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 3864)
@@ -2747,4 +2747,12 @@
 
     /**
+     * Specify video window's flags. The value is a bitmask combination of
+     * #pjmedia_vid_dev_wnd_flag.
+     *
+     * Default: 0
+     */
+    unsigned         vid_wnd_flags;
+
+    /**
      * Specify the default capture device to be used by this account. If
      * \a vid_out_auto_transmit is enabled, this device will be used for
@@ -5739,4 +5747,12 @@
     pj_bool_t			show;
 
+    /**
+     * Window flags.  The value is a bitmask combination of
+     * #pjmedia_vid_dev_wnd_flag.
+     *
+     * Default: 0.
+     */
+    unsigned			wnd_flags;
+
 } pjsua_vid_preview_param;
 
Index: /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c	(revision 3863)
+++ /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c	(revision 3864)
@@ -1065,4 +1065,5 @@
     acc->cfg.vid_in_auto_show = cfg->vid_in_auto_show;
     acc->cfg.vid_out_auto_transmit = cfg->vid_out_auto_transmit;
+    acc->cfg.vid_wnd_flags = cfg->vid_wnd_flags;
     acc->cfg.vid_cap_dev = cfg->vid_cap_dev;
     acc->cfg.vid_rend_dev = cfg->vid_rend_dev;
Index: /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_vid.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_vid.c	(revision 3863)
+++ /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_vid.c	(revision 3864)
@@ -389,4 +389,5 @@
 				  pjmedia_vid_dev_index cap_id,
 				  pj_bool_t show,
+                                  unsigned wnd_flags,
 				  pjsua_vid_win_id *id)
 {
@@ -433,4 +434,8 @@
 				    &hide);
 
+	    pjmedia_vid_dev_stream_set_cap(
+                                strm, PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS,
+				&wnd_flags);
+
 	    /* Done */
 	    *id = wid;
@@ -483,4 +488,6 @@
 	    vp_param.vidparam.flags |= PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE;
 	    vp_param.vidparam.window_hide = !show;
+	    vp_param.vidparam.flags |= PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS;
+	    vp_param.vidparam.window_flags = wnd_flags;
 	}
 
@@ -544,4 +551,6 @@
 	vp_param.vidparam.flags |= PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE;
 	vp_param.vidparam.window_hide = !show;
+        vp_param.vidparam.flags |= PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS;
+        vp_param.vidparam.window_flags = wnd_flags;
 
 	status = pjmedia_vid_port_create(w->pool, &vp_param, &w->vp_rend);
@@ -787,4 +796,5 @@
 				    PJSUA_INVALID_ID,
 				    acc->cfg.vid_in_auto_show,
+                                    acc->cfg.vid_wnd_flags,
 				    &wid);
 	    if (status != PJ_SUCCESS) {
@@ -826,4 +836,5 @@
 	if (si->dir & PJMEDIA_DIR_ENCODING && !call->local_hold)
 	{
+            pjsua_acc *acc = &pjsua_var.acc[call_med->call->acc_id];
 	    pjsua_vid_win *w;
 	    pjsua_vid_win_id wid;
@@ -856,4 +867,5 @@
 					//acc->cfg.vid_cap_dev,
 					PJSUA_HIDE_WINDOW,
+                                        acc->cfg.vid_wnd_flags,
 					&wid);
 		if (status != PJ_SUCCESS) {
@@ -1071,5 +1083,5 @@
 
     status = create_vid_win(PJSUA_WND_TYPE_PREVIEW, NULL, rend_id, id,
-			    prm->show, &wid);
+			    prm->show, prm->wnd_flags, &wid);
     if (status != PJ_SUCCESS) {
 	PJSUA_UNLOCK();
@@ -1848,4 +1860,6 @@
     new_wid = vid_preview_get_win(cap_dev, PJ_FALSE);
     if (new_wid == PJSUA_INVALID_ID) {
+        pjsua_acc *acc = &pjsua_var.acc[call_med->call->acc_id];
+
 	/* Create preview video window */
 	status = create_vid_win(PJSUA_WND_TYPE_PREVIEW,
@@ -1854,5 +1868,6 @@
 				cap_dev,
 				PJSUA_HIDE_WINDOW,
-				&new_wid);
+				acc->cfg.vid_wnd_flags,
+                                &new_wid);
 	if (status != PJ_SUCCESS)
 	    goto on_error;
