/[rdesktop]/jpeg/rdesktop/trunk/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 /jpeg/rdesktop/trunk/xwin.c

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

revision 1407 by astrand, Mon May 14 12:11:15 2007 UTC revision 1443 by astrand, Thu Mar 6 15:39:21 2008 UTC
# Line 2  Line 2 
2     rdesktop: A Remote Desktop Protocol client.     rdesktop: A Remote Desktop Protocol client.
3     User interface services - X Window System     User interface services - X Window System
4     Copyright (C) Matthew Chapman 1999-2007     Copyright (C) Matthew Chapman 1999-2007
5       Copyright 2007 Pierre Ossman <ossman@cendio.se> for Cendio AB
6    
7     This program is free software; you can redistribute it and/or modify     This program is free software; you can redistribute it and/or modify
8     it under the terms of the GNU General Public License as published by     it under the terms of the GNU General Public License as published by
# Line 74  typedef struct _seamless_window Line 75  typedef struct _seamless_window
75          int outpos_xoffset, outpos_yoffset;          int outpos_xoffset, outpos_yoffset;
76          int outpos_width, outpos_height;          int outpos_width, outpos_height;
77    
78            unsigned int icon_size;
79            unsigned int icon_offset;
80            char icon_buffer[32 * 32 * 4];
81    
82          struct _seamless_window *next;          struct _seamless_window *next;
83  } seamless_window;  } seamless_window;
84  static seamless_window *g_seamless_windows = NULL;  static seamless_window *g_seamless_windows = NULL;
# Line 578  translate_colour(uint32 colour) Line 583  translate_colour(uint32 colour)
583                          SPLITCOLOUR16(colour, pc);                          SPLITCOLOUR16(colour, pc);
584                          break;                          break;
585                  case 24:                  case 24:
586                    case 32:
587                          SPLITCOLOUR24(colour, pc);                          SPLITCOLOUR24(colour, pc);
588                          break;                          break;
589                  default:                  default:
# Line 1186  translate_image(int width, int height, u Line 1192  translate_image(int width, int height, u
1192             is only set for compatible depths, but the RDP depth might've             is only set for compatible depths, but the RDP depth might've
1193             changed during connection negotiations.             changed during connection negotiations.
1194           */           */
1195    
1196            /* todo */
1197            if (g_server_depth == 32 && g_depth == 24)
1198            {
1199                    return data;
1200            }
1201    
1202          if (g_no_translate_image)          if (g_no_translate_image)
1203          {          {
1204                  if ((g_depth == 15 && g_server_depth == 15) ||                  if ((g_depth == 15 && g_server_depth == 15) ||
# Line 3439  ui_seamless_create_window(unsigned long Line 3452  ui_seamless_create_window(unsigned long
3452                  ewmh_set_window_modal(wnd);                  ewmh_set_window_modal(wnd);
3453          }          }
3454    
3455            if (flags & SEAMLESSRDP_CREATE_TOPMOST)
3456            {
3457                    /* Make window always-on-top */
3458                    ewmh_set_window_above(wnd);
3459            }
3460    
3461          /* FIXME: Support for Input Context:s */          /* FIXME: Support for Input Context:s */
3462    
3463          get_input_mask(&input_mask);          get_input_mask(&input_mask);
# Line 3452  ui_seamless_create_window(unsigned long Line 3471  ui_seamless_create_window(unsigned long
3471          XSetWMProtocols(g_display, wnd, &g_kill_atom, 1);          XSetWMProtocols(g_display, wnd, &g_kill_atom, 1);
3472    
3473          sw = xmalloc(sizeof(seamless_window));          sw = xmalloc(sizeof(seamless_window));
3474    
3475            memset(sw, 0, sizeof(seamless_window));
3476    
3477          sw->wnd = wnd;          sw->wnd = wnd;
3478          sw->id = id;          sw->id = id;
         sw->behind = 0;  
3479          sw->group = sw_find_group(group, False);          sw->group = sw_find_group(group, False);
3480          sw->group->refcnt++;          sw->group->refcnt++;
         sw->xoffset = 0;  
         sw->yoffset = 0;  
         sw->width = 0;  
         sw->height = 0;  
3481          sw->state = SEAMLESSRDP_NOTYETMAPPED;          sw->state = SEAMLESSRDP_NOTYETMAPPED;
3482          sw->desktop = 0;          sw->desktop = 0;
3483          sw->position_timer = xmalloc(sizeof(struct timeval));          sw->position_timer = xmalloc(sizeof(struct timeval));
# Line 3528  ui_seamless_destroy_group(unsigned long Line 3545  ui_seamless_destroy_group(unsigned long
3545    
3546    
3547  void  void
3548    ui_seamless_seticon(unsigned long id, const char *format, int width, int height, int chunk,
3549                        const char *data, int chunk_len)
3550    {
3551            seamless_window *sw;
3552    
3553            if (!g_seamless_active)
3554                    return;
3555    
3556            sw = sw_get_window_by_id(id);
3557            if (!sw)
3558            {
3559                    warning("ui_seamless_seticon: No information for window 0x%lx\n", id);
3560                    return;
3561            }
3562    
3563            if (chunk == 0)
3564            {
3565                    if (sw->icon_size)
3566                            warning("ui_seamless_seticon: New icon started before previous completed\n");
3567    
3568                    if (strcmp(format, "RGBA") != 0)
3569                    {
3570                            warning("ui_seamless_seticon: Uknown icon format \"%s\"\n", format);
3571                            return;
3572                    }
3573    
3574                    sw->icon_size = width * height * 4;
3575                    if (sw->icon_size > 32 * 32 * 4)
3576                    {
3577                            warning("ui_seamless_seticon: Icon too large (%d bytes)\n", sw->icon_size);
3578                            sw->icon_size = 0;
3579                            return;
3580                    }
3581    
3582                    sw->icon_offset = 0;
3583            }
3584            else
3585            {
3586                    if (!sw->icon_size)
3587                            return;
3588            }
3589    
3590            if (chunk_len > (sw->icon_size - sw->icon_offset))
3591            {
3592                    warning("ui_seamless_seticon: Too large chunk received (%d bytes > %d bytes)\n",
3593                            chunk_len, sw->icon_size - sw->icon_offset);
3594                    sw->icon_size = 0;
3595                    return;
3596            }
3597    
3598            memcpy(sw->icon_buffer + sw->icon_offset, data, chunk_len);
3599            sw->icon_offset += chunk_len;
3600    
3601            if (sw->icon_offset == sw->icon_size)
3602            {
3603                    ewmh_set_icon(sw->wnd, width, height, sw->icon_buffer);
3604                    sw->icon_size = 0;
3605            }
3606    }
3607    
3608    
3609    void
3610    ui_seamless_delicon(unsigned long id, const char *format, int width, int height)
3611    {
3612            seamless_window *sw;
3613    
3614            if (!g_seamless_active)
3615                    return;
3616    
3617            sw = sw_get_window_by_id(id);
3618            if (!sw)
3619            {
3620                    warning("ui_seamless_seticon: No information for window 0x%lx\n", id);
3621                    return;
3622            }
3623    
3624            if (strcmp(format, "RGBA") != 0)
3625            {
3626                    warning("ui_seamless_seticon: Uknown icon format \"%s\"\n", format);
3627                    return;
3628            }
3629    
3630            ewmh_del_icon(sw->wnd, width, height);
3631    }
3632    
3633    
3634    void
3635  ui_seamless_move_window(unsigned long id, int x, int y, int width, int height, unsigned long flags)  ui_seamless_move_window(unsigned long id, int x, int y, int width, int height, unsigned long flags)
3636  {  {
3637          seamless_window *sw;          seamless_window *sw;
# Line 3608  ui_seamless_restack_window(unsigned long Line 3712  ui_seamless_restack_window(unsigned long
3712          }          }
3713    
3714          sw_restack_window(sw, behind);          sw_restack_window(sw, behind);
3715    
3716            if (flags & SEAMLESSRDP_CREATE_TOPMOST)
3717            {
3718                    /* Make window always-on-top */
3719                    ewmh_set_window_above(sw->wnd);
3720            }
3721  }  }
3722    
3723    

Legend:
Removed from v.1407  
changed lines
  Added in v.1443

  ViewVC Help
Powered by ViewVC 1.1.26