~ubuntu-branches/ubuntu/karmic/italc/karmic-updates

« back to all changes in this revision

Viewing changes to ica/x11/x11vnc/cursor.c

  • Committer: Bazaar Package Importer
  • Author(s): Stéphane Graber
  • Date: 2008-02-11 23:40:20 UTC
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: james.westby@ubuntu.com-20080211234020-o9fixmzxpa1ybhlq
Tags: upstream-1.0.6
Import upstream version 1.0.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
#include "screen.h"
7
7
#include "scan.h"
8
8
#include "unixpw.h"
 
9
#include "macosx.h"
9
10
 
10
11
int xfixes_present = 0;
11
12
int use_xfixes = 1;
836
837
 *
837
838
 */
838
839
static void tree_descend_cursor(int *depth, Window *w, win_str_info_t *winfo) {
 
840
#if NO_X11
 
841
        RAWFB_RET_VOID
 
842
        if (!depth || !w || !winfo) {}
 
843
        return;
 
844
#else
839
845
        Window r, c;
840
846
        int i, rx, ry, wx, wy;
841
847
        unsigned int mask;
847
853
        XErrorHandler old_handler;
848
854
 
849
855
        RAWFB_RET_VOID
850
 
#if NO_X11
851
 
        return;
852
 
#else
853
856
 
854
857
        X_LOCK;
855
858
 
1110
1113
                        a = 0xff000000 & (*(pixels+i));
1111
1114
                        a = a >> 24;    /* alpha channel */
1112
1115
 
1113
 
 
1114
1116
                        if (a < (unsigned int) thresh) {
1115
1117
                                bitmap[i] = ' ';
1116
1118
                        } else {
1207
1209
        c->cleanupRichSource = FALSE;
1208
1210
        c->richSource = (unsigned char *) rich;
1209
1211
 
 
1212
        /* zeroes mean interpolate the rich cursor somehow and use B+W */
 
1213
        c->foreRed   = 0;
 
1214
        c->foreGreen = 0;
 
1215
        c->foreBlue  = 0;
 
1216
        c->backRed   = 0;
 
1217
        c->backGreen = 0;
 
1218
        c->backBlue  = 0;
 
1219
 
 
1220
        c->source = NULL;
 
1221
 
1210
1222
        if (alpha_blend && !indexed_color) {
1211
1223
                c->alphaSource = (unsigned char *) alpha;
1212
1224
                c->alphaPreMultiplied = TRUE;
1227
1239
                return last_cursor;
1228
1240
        } else if (mode == 1) {
1229
1241
                return (unsigned long) last_index;
 
1242
        } else {
 
1243
                return (unsigned long) last_index;
1230
1244
        }
1231
1245
}
1232
1246
 
1251
1265
        }
1252
1266
#endif
1253
1267
 
 
1268
        if (rawfb_vnc_reflect) {
 
1269
                int last_idx = (int) get_cursor_serial(1);
 
1270
                if (last_idx) {
 
1271
                        which = last_idx;
 
1272
                }
 
1273
                return which;
 
1274
        }
1254
1275
        if (xfixes_present && dpy) {
1255
1276
#if LIBVNCSERVER_HAVE_LIBXFIXES
1256
1277
                int last_idx = (int) get_cursor_serial(1);
1320
1341
                        oldest = i;
1321
1342
                        oldtime = curs_times[i];
1322
1343
                }
1323
 
                if (serial == curs_index[i]) {
 
1344
                if (serial == (int) curs_index[i]) {
1324
1345
                        /*
1325
1346
                         * got a hit with an existing cursor,
1326
1347
                         * use that one.
1458
1479
        int db = 0;
1459
1480
 
1460
1481
        if (show_multiple_cursors) {
1461
 
                int depth;
 
1482
                int depth = 0;
1462
1483
                static win_str_info_t winfo;
1463
1484
                static int first = 1, depth_cutoff = -1;
1464
 
                Window win;
 
1485
                Window win = None;
1465
1486
                XErrorHandler old_handler;
1466
1487
                int mode = 0;
1467
1488
 
1485
1506
                        mode = 3;
1486
1507
                }
1487
1508
 
 
1509
                if (rawfb_vnc_reflect && mode > -1) {
 
1510
                        return get_exact_cursor(0);
 
1511
                }
1488
1512
                if (mode == 3) {
1489
1513
                        if ((xfixes_present && use_xfixes) || macosx_console) {
1490
1514
                                if (db) fprintf(stderr, "get_which_cursor call get_exact_cursor\n");
1537
1561
                                XSetErrorHandler(old_handler);
1538
1562
                                X_UNLOCK;
1539
1563
                                trapped_xerror = 0;
 
1564
#else
 
1565
                                if (!r || !d || !bw || !h || !w || !y || !x || !ratio || !old_handler) {}
1540
1566
#endif  /* NO_X11 */
1541
1567
                        }
1542
1568
                        if (which == which0) {
1705
1731
        return count;
1706
1732
}
1707
1733
 
 
1734
int cursor_noshape_updates_clients(rfbScreenInfoPtr s) {
 
1735
        rfbClientIteratorPtr iter;
 
1736
        rfbClientPtr cl;
 
1737
        int count = 0;
 
1738
 
 
1739
        if (! s) {
 
1740
                return 0;
 
1741
        }
 
1742
        iter = rfbGetClientIterator(s);
 
1743
        while( (cl = rfbClientIteratorNext(iter)) ) {
 
1744
                if (!cl->enableCursorShapeUpdates) {
 
1745
                        count++;
 
1746
                }
 
1747
        }
 
1748
        rfbReleaseClientIterator(iter);
 
1749
        return count;
 
1750
}
 
1751
 
1708
1752
int cursor_pos_updates_clients(rfbScreenInfoPtr s) {
1709
1753
        rfbClientIteratorPtr iter;
1710
1754
        rfbClientPtr cl;
1746
1790
                y = nfix(y, scaled_y);
1747
1791
        }
1748
1792
 
 
1793
        if (clipshift) {
 
1794
                if (x < 0) x = 0;
 
1795
                if (y < 0) y = 0;
 
1796
                if (x >= dpy_x) x = dpy_x-1;
 
1797
                if (y >= dpy_y) y = dpy_y-1;
 
1798
        }
 
1799
 
1749
1800
        if (x == screen->cursorX && y == screen->cursorY) {
1750
1801
                return;
1751
1802
        }
1850
1901
 
1851
1902
        if (unixpw_in_progress) return 0;
1852
1903
 
1853
 
 
1854
1904
#ifdef MACOSX
1855
1905
        if (macosx_console) {
1856
1906
                ret = macosx_get_cursor_pos(&root_x, &root_y);
1858
1908
                RAWFB_RET(0)
1859
1909
        }
1860
1910
#else
 
1911
 
1861
1912
        RAWFB_RET(0)
1862
1913
 
1863
1914
#   if NO_X11
1874
1925
                    &win_x, &win_y, &mask);
1875
1926
                X_UNLOCK;
1876
1927
        }
 
1928
#else
 
1929
        if (!mask || !win_y || !win_x || !child_w || !root_w) {}
1877
1930
#endif  /* NO_X11 */
1878
1931
 
1879
1932
if (0) fprintf(stderr, "check_x11_pointer %d %d\n", root_x, root_y);
1894
1947
        x = root_x - off_x - coff_x;
1895
1948
        y = root_y - off_y - coff_y;
1896
1949
 
 
1950
        if (clipshift) {
 
1951
                static int cnt = 0;
 
1952
                if (x < 0 || y < 0 || x >= dpy_x || y >= dpy_y)  {
 
1953
                        if (cnt++ % 4 != 0) {
 
1954
                                if (debug_pointer) {
 
1955
                                        rfbLog("Skipping cursor_position() outside our clipshift\n");
 
1956
                                }
 
1957
                                return 0;
 
1958
                        }
 
1959
                }
 
1960
        }
 
1961
 
1897
1962
        /* record the cursor position in the rfb screen */
1898
1963
        cursor_position(x, y);
1899
1964