/[rdesktop]/sourceforge.net/branches/seamlessrdp-branch/rdesktop/xwin.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/branches/seamlessrdp-branch/rdesktop/xwin.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1122 by astrand, Wed Mar 15 08:35:13 2006 UTC revision 1140 by ossman_, Wed Mar 15 15:27:24 2006 UTC
# Line 56  typedef struct _seamless_window Line 56  typedef struct _seamless_window
56          unsigned long id;          unsigned long id;
57          int xoffset, yoffset;          int xoffset, yoffset;
58          int width, height;          int width, height;
59          unsigned int state;     /* normal/minimized/maximized */          int state;              /* normal/minimized/maximized. */
60          unsigned int desktop;          unsigned int desktop;
61          struct _seamless_window *next;          struct _seamless_window *next;
62  } seamless_window;  } seamless_window;
# Line 3044  ui_seamless_create_window(unsigned long Line 3044  ui_seamless_create_window(unsigned long
3044          Window wnd;          Window wnd;
3045          XSetWindowAttributes attribs;          XSetWindowAttributes attribs;
3046          XClassHint *classhints;          XClassHint *classhints;
3047            XSizeHints *sizehints;
3048          long input_mask;          long input_mask;
3049          seamless_window *sw, *sw_parent;          seamless_window *sw, *sw_parent;
3050    
# Line 3055  ui_seamless_create_window(unsigned long Line 3056  ui_seamless_create_window(unsigned long
3056          get_window_attribs(&attribs);          get_window_attribs(&attribs);
3057          attribs.override_redirect = False;          attribs.override_redirect = False;
3058    
3059          /* FIXME: Do not assume that -1, -1 is outside screen Consider          wnd = XCreateWindow(g_display, RootWindowOfScreen(g_screen), -1, -1, 1, 1, 0, g_depth,
            wait with showing the window until STATE and others have  
            been recieved. */  
         wnd = XCreateWindow(g_display, RootWindowOfScreen(g_screen), -1, -1, 1, 1, 0, 0,  
3060                              InputOutput, g_visual,                              InputOutput, g_visual,
3061                              CWBackPixel | CWBackingStore | CWOverrideRedirect | CWColormap |                              CWBackPixel | CWBackingStore | CWOverrideRedirect | CWColormap |
3062                              CWBorderPixel, &attribs);                              CWBorderPixel, &attribs);
3063    
3064          XStoreName(g_display, wnd, "rdesktop-seamless");          XStoreName(g_display, wnd, "SeamlessRDP");
3065            ewmh_set_wm_name(wnd, "SeamlessRDP");
3066    
3067          mwm_hide_decorations(wnd);          mwm_hide_decorations(wnd);
3068    
3069          classhints = XAllocClassHint();          classhints = XAllocClassHint();
3070          if (classhints != NULL)          if (classhints != NULL)
3071          {          {
3072                  classhints->res_name = classhints->res_class = "rdesktop";                  classhints->res_name = "rdesktop";
3073                    classhints->res_class = "SeamlessRDP";
3074                  XSetClassHint(g_display, wnd, classhints);                  XSetClassHint(g_display, wnd, classhints);
3075                  XFree(classhints);                  XFree(classhints);
3076          }          }
3077    
3078            /* WM_NORMAL_HINTS */
3079            sizehints = XAllocSizeHints();
3080            if (sizehints != NULL)
3081            {
3082                    sizehints->flags = USPosition;
3083                    XSetWMNormalHints(g_display, wnd, sizehints);
3084                    XFree(sizehints);
3085            }
3086    
3087            /* Handle popups without parents through some ewm hints */
3088            if (parent == 0xFFFFFFFF)
3089                    ewmh_set_window_popup(wnd);
3090          /* Set WM_TRANSIENT_FOR, if necessary */          /* Set WM_TRANSIENT_FOR, if necessary */
3091          if (parent)          else if (parent != 0x00000000)
3092          {          {
3093                  sw_parent = seamless_get_window_by_id(parent);                  sw_parent = seamless_get_window_by_id(parent);
3094                  if (sw_parent)                  if (sw_parent)
# Line 3085  ui_seamless_create_window(unsigned long Line 3097  ui_seamless_create_window(unsigned long
3097                          warning("ui_seamless_create_window: No parent window 0x%lx\n", parent);                          warning("ui_seamless_create_window: No parent window 0x%lx\n", parent);
3098          }          }
3099    
3100    
3101          /* FIXME: Support for Input Context:s */          /* FIXME: Support for Input Context:s */
3102    
3103          get_input_mask(&input_mask);          get_input_mask(&input_mask);
# Line 3092  ui_seamless_create_window(unsigned long Line 3105  ui_seamless_create_window(unsigned long
3105    
3106          XSelectInput(g_display, wnd, input_mask);          XSelectInput(g_display, wnd, input_mask);
3107    
         XMapWindow(g_display, wnd);  
   
3108          /* handle the WM_DELETE_WINDOW protocol. FIXME: When killing a          /* handle the WM_DELETE_WINDOW protocol. FIXME: When killing a
3109             seamless window, we could try to close the window on the             seamless window, we could try to close the window on the
3110             serverside, instead of terminating rdesktop */             serverside, instead of terminating rdesktop */
# Line 3106  ui_seamless_create_window(unsigned long Line 3117  ui_seamless_create_window(unsigned long
3117          sw->yoffset = 0;          sw->yoffset = 0;
3118          sw->width = 0;          sw->width = 0;
3119          sw->height = 0;          sw->height = 0;
3120            sw->state = SEAMLESSRDP_NOTYETMAPPED;
3121            sw->desktop = 0;
3122          sw->next = g_seamless_windows;          sw->next = g_seamless_windows;
3123          g_seamless_windows = sw;          g_seamless_windows = sw;
3124  }  }
# Line 3157  ui_seamless_move_window(unsigned long id Line 3170  ui_seamless_move_window(unsigned long id
3170    
3171          /* If we move the window in a maximized state, then KDE won't          /* If we move the window in a maximized state, then KDE won't
3172             accept restoration */             accept restoration */
3173          if (sw->state != SEAMLESSRDP_NORMAL)          switch (sw->state)
3174                  return;          {
3175                    case SEAMLESSRDP_MINIMIZED:
3176                    case SEAMLESSRDP_MAXIMIZED:
3177                            return;
3178            }
3179    
3180          /* FIXME: Perhaps use ewmh_net_moveresize_window instead */          /* FIXME: Perhaps use ewmh_net_moveresize_window instead */
3181          XMoveResizeWindow(g_display, sw->wnd, sw->xoffset, sw->yoffset, sw->width, sw->height);          XMoveResizeWindow(g_display, sw->wnd, sw->xoffset, sw->yoffset, sw->width, sw->height);
# Line 3177  ui_seamless_settitle(unsigned long id, c Line 3194  ui_seamless_settitle(unsigned long id, c
3194                  return;                  return;
3195          }          }
3196    
3197            /* FIXME: Might want to convert the name for non-EWMH WMs */
3198          XStoreName(g_display, sw->wnd, title);          XStoreName(g_display, sw->wnd, title);
3199            ewmh_set_wm_name(sw->wnd, title);
3200  }  }
3201    
3202    
# Line 3193  ui_seamless_setstate(unsigned long id, u Line 3212  ui_seamless_setstate(unsigned long id, u
3212                  return;                  return;
3213          }          }
3214    
3215            if (sw->state == SEAMLESSRDP_NOTYETMAPPED)
3216            {
3217                    XMapWindow(g_display, sw->wnd);
3218            }
3219    
3220          sw->state = state;          sw->state = state;
3221    
3222          switch (state)          switch (state)
# Line 3214  ui_seamless_setstate(unsigned long id, u Line 3238  ui_seamless_setstate(unsigned long id, u
3238                          break;                          break;
3239          }          }
3240  }  }
3241    
3242    
3243    void
3244    ui_seamless_syncbegin(unsigned long flags)
3245    {
3246            /* Destroy all seamless windows */
3247            while (g_seamless_windows)
3248            {
3249                    XDestroyWindow(g_display, g_seamless_windows->wnd);
3250                    seamless_remove_window(g_seamless_windows);
3251            }
3252    }

Legend:
Removed from v.1122  
changed lines
  Added in v.1140

  ViewVC Help
Powered by ViewVC 1.1.26