Changeset 1071 for branches


Ignore:
Timestamp:
May 21, 2008, 3:03:31 PM (10 years ago)
Author:
Daniel Kahn Gillmor
Message:

[svn-upgrade] Integrating new upstream version, xdotool (20080521)

Location:
branches/upstream/xdotool/current
Files:
2 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • branches/upstream/xdotool/current/CHANGELIST

    r1062 r1071  
    1 20071230:
    2   * Manpage contribution by Daniel Kahn Gillmor
    3   * Add COPYRIGHT from svn to the distributed package.
     120080521:
     2  * Import patches from keynav's xdotool branch (From Lukas Mai) which make
     3    xdotool compile happily when building with -Wall and -pedantic (and others)
     4  * Finally convert to using Window type for (hopefully) everything instead of
     5    incorrectly typecasting Window to int sometimes.
     6  * Confirmed that the one (but mostly useless) test passes.
    47
    5820070903:
  • branches/upstream/xdotool/current/Makefile

    r1062 r1071  
    1 CFLAGS+=-Wall
     1CFLAGS+= -std=c99 -pedantic -Wall -W -Wno-missing-field-initializers -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization -O2 -pipe
    22
    33DEFAULT_LIBS=-L/usr/X11R6/lib -L/usr/local/lib -lX11 -lXtst
     
    3333        echo "Creating package: $$NAME"; \
    3434        mkdir $${NAME}; \
    35         rsync --exclude .svn -a `ls -d *.c *.1 *.h examples t COPYRIGHT CHANGELIST README Makefile* 2> /dev/null` $${NAME}/; \
     35        rsync --exclude .svn -a `ls -d *.c *.h examples t CHANGELIST README Makefile* 2> /dev/null` $${NAME}/; \
    3636        tar -zcf $${NAME}.tar.gz $${NAME}/; \
    3737        rm -rf $${NAME}/
  • branches/upstream/xdotool/current/README

    r1062 r1071  
    3131      See 'xwininfo' output for what each of these are/mean.
    3232
    33 $Id: README 1515 2007-08-12 23:22:01Z psionic $
     33$Id: README 1520 2007-08-12 23:51:17Z psionic $
  • branches/upstream/xdotool/current/xdo.c

    r1062 r1071  
    11/* xdo library
    22 *
    3  * $Id: xdo.c 1538 2007-09-04 06:00:24Z psionic $
     3 * $Id: xdo.c 1854 2008-05-21 07:23:29Z jordansissel $
    44 *
    55 * - getwindowfocus contributed by Lee Pumphret
     
    88 */
    99
     10#define _XOPEN_SOURCE 500
    1011#include <sys/select.h>
    1112#include <stdlib.h>
    1213#include <stdio.h>
    1314#include <string.h>
     15#include <strings.h>
    1416#include <unistd.h>
    1517#include <regex.h>
     
    5557}
    5658
    57 xdo_t* xdo_new_with_opened_display(Display *xdpy, char *display,
     59xdo_t* xdo_new_with_opened_display(Display *xdpy, const char *display,
    5860                                   int close_display_when_freed) {
    5961  xdo_t *xdo = NULL;
     
    9799}
    98100
    99 int xdo_window_map(xdo_t *xdo, int wid) {
     101int xdo_window_map(xdo_t *xdo, Window wid) {
    100102  int ret;
    101103  ret = XMapWindow(xdo->xdpy, wid);
     
    104106}
    105107
    106 int xdo_window_unmap(xdo_t *xdo, int wid) {
     108int xdo_window_unmap(xdo_t *xdo, Window wid) {
    107109  int ret;
    108110  ret = XUnmapWindow(xdo->xdpy, wid);
     
    120122
    121123  int ret;
     124  int i;
    122125
    123126  ret = regcomp(&re, regex, REG_EXTENDED | REG_ICASE);
     
    142145                         &total_window_list, &ntotal_windows,
    143146                         &window_list_size);
    144   int i;
    145147  for (i = 0; i < ntotal_windows; i++) {
    146148    Window wid = total_window_list[i];
     
    164166}
    165167
    166 int xdo_window_move(xdo_t *xdo, int wid, int x, int y) {
     168int xdo_window_move(xdo_t *xdo, Window wid, int x, int y) {
    167169  XWindowChanges wc;
    168170  int ret;
     
    174176}
    175177
    176 int xdo_window_setsize(xdo_t *xdo, int wid, int width, int height, int flags) {
     178int xdo_window_setsize(xdo_t *xdo, Window wid, int width, int height, int flags) {
    177179  XWindowChanges wc;
    178180  int ret;
     
    211213}
    212214
    213 int xdo_window_focus(xdo_t *xdo, int wid) {
     215int xdo_window_focus(xdo_t *xdo, Window wid) {
    214216  int ret;
    215217  ret = XSetInputFocus(xdo->xdpy, wid, RevertToParent, CurrentTime);
     
    219221
    220222/* XRaiseWindow is ignored in ion3 and Gnome2. Is it even useful? */
    221 int xdo_window_raise(xdo_t *xdo, int wid) {
     223int xdo_window_raise(xdo_t *xdo, Window wid) {
    222224  int ret;
    223225  ret = XRaiseWindow(xdo->xdpy, wid);
     
    295297  int *keys = NULL;
    296298  int nkeys;
     299  int i;
    297300
    298301  if (_xdo_keysequence_to_keycode_list(xdo, keyseq, &keys, &nkeys) == False) {
     
    301304  }
    302305
    303   int i;
    304306  for (i = 0; i < nkeys; i++) {
    305307    //fprintf(stderr, "Typing %d (%d)\n", keys[i], pressed);
     
    329331/* Add by Lee Pumphret 2007-07-28
    330332 * Modified slightly by Jordan Sissel */
    331 int xdo_window_get_focus(xdo_t *xdo, int *window_ret) {
     333int xdo_window_get_focus(xdo_t *xdo, Window *window_ret) {
    332334  int ret;
    333335  int unused_revert_ret;
    334   ret = XGetInputFocus(xdo->xdpy, (Window*)window_ret, &unused_revert_ret);
     336  ret = XGetInputFocus(xdo->xdpy, window_ret, &unused_revert_ret);
    335337  return _is_success("XGetInputFocus", ret);
    336338}
     
    391393     * hence this little loop. */
    392394    for (j = 0; j <= 1; j++) {
    393      int index = (i - xdo->keycode_low) * 2 + j;
     395     int idx = (i - xdo->keycode_low) * 2 + j;
    394396     keybuf = XKeysymToString(XKeycodeToKeysym(xdo->xdpy, i, j));
    395397
    396      xdo->charcodes[index].key = _keysym_to_char(keybuf);
    397      xdo->charcodes[index].code = i;
    398      xdo->charcodes[index].shift = j ? shift_keycode : 0;
     398     xdo->charcodes[idx].key = _keysym_to_char(keybuf);
     399     xdo->charcodes[idx].code = i;
     400     xdo->charcodes[idx].shift = j ? shift_keycode : 0;
    399401    }
    400402  }
     
    427429                                   int *window_list_size) {
    428430  Window dummy;
    429   int i;
    430431  Window *children;
    431   unsigned int nchildren;
     432  unsigned int i, nchildren;
    432433
    433434  if (*window_list_size == 0) {
     
    459460int _xdo_keysequence_to_keycode_list(xdo_t *xdo, char *keyseq, int **keys, int *nkeys) {
    460461  char *tokctx = NULL;
    461   char *tok = NULL;
     462  const char *tok = NULL;
    462463  char *strptr = NULL;
    463464  int i;
  • branches/upstream/xdotool/current/xdo.h

    r1062 r1071  
    33 * - include this if you have code that uses xdo
    44 *
    5  * $Id: xdo.h 1538 2007-09-04 06:00:24Z psionic $
     5 * $Id: xdo.h 1854 2008-05-21 07:23:29Z jordansissel $
    66 */
    77
     
    1717/* Map keysym name to actual ascii */
    1818typedef struct keysymcharmap {
    19   char *keysym;
     19  const char *keysym;
    2020  char key;
    2121} keysymcharmap_t;
     
    4040
    4141xdo_t* xdo_new(char *display);
    42 xdo_t* xdo_new_with_opened_display(Display *xdpy, char *display,
     42xdo_t* xdo_new_with_opened_display(Display *xdpy, const char *display,
    4343                                   int close_display_when_freed);
    4444void xdo_free(xdo_t *xdo);
     
    5656int xdo_keysequence_down(xdo_t *xdo, char *keysequence);
    5757
    58 int xdo_window_move(xdo_t *xdo, int wid, int x, int y);
    59 int xdo_window_setsize(xdo_t *xdo, int wid, int w, int h, int flags);
    60 int xdo_window_focus(xdo_t *xdo, int wid);
    61 int xdo_window_raise(xdo_t *xdo, int wid);
    62 int xdo_window_get_focus(xdo_t *xdo, int *window_ret);
     58int xdo_window_move(xdo_t *xdo, Window wid, int x, int y);
     59int xdo_window_setsize(xdo_t *xdo, Window wid, int w, int h, int flags);
     60int xdo_window_focus(xdo_t *xdo, Window wid);
     61int xdo_window_raise(xdo_t *xdo, Window wid);
     62int xdo_window_get_focus(xdo_t *xdo, Window *window_ret);
    6363
    64 int xdo_window_map(xdo_t *xdo, int wid);
    65 int xdo_window_unmap(xdo_t *xdo, int wid);
     64int xdo_window_map(xdo_t *xdo, Window wid);
     65int xdo_window_unmap(xdo_t *xdo, Window wid);
    6666
    6767/* Returns: windowlist and nwindows */
  • branches/upstream/xdotool/current/xdo_util.h

    r1062 r1071  
    11/* xdo utility pieces
    22 *
    3  * $Id: xdo_util.h 1487 2007-07-22 08:37:07Z psionic $
     3 * $Id: xdo_util.h 1854 2008-05-21 07:23:29Z jordansissel $
    44 */
    55
    66/* human to Keysym string mapping */
    7 char *symbol_map[] = {
     7const char *symbol_map[] = {
    88  "alt", "Alt_L",
    99  "ctrl", "Control_L",
  • branches/upstream/xdotool/current/xdotool.c

    r1062 r1071  
    33 * command line interface to the xdo library
    44 *
    5  * $Id: xdotool.c 1538 2007-09-04 06:00:24Z psionic $
     5 * $Id: xdotool.c 1854 2008-05-21 07:23:29Z jordansissel $
    66 *
    77 * getwindowfocus contributed by Lee Pumphret
     
    1515#include <getopt.h>
    1616#include <string.h>
     17#include <strings.h>
     18
    1719
    1820#include "xdo.h"
     
    2022void cmd_click(int argc, char **args);
    2123void cmd_getwindowfocus(int argc, char **args);
    22 void cmd_help(int argc, char **args);
     24void cmd_help(int unused_argc, char **unused_args);
    2325void cmd_key(int argc, char **args);
    2426void cmd_mousedown(int argc, char **args);
     
    3840
    3941xdo_t *xdo;
     42void window_print(Window wid);
    4043
    4144struct dispatch {
     
    99102}
    100103
    101 void cmd_help(int argc, char **args) {
     104void window_print(Window wid) {
     105  switch (sizeof(Window)) {
     106    case sizeof(int):
     107      printf("%d\n", (int)wid);
     108      break;
     109    case sizeof(long):
     110      printf("%ld\n", (long)wid);
     111      break;
     112    default:
     113      printf("Unknown window storage size (%ld)\n", sizeof(Window));
     114  }
     115}
     116
     117void cmd_help(int unused_argc, char **unused_args) {
    102118  int i;
    103119  printf("Available commands:\n");
     
    251267  }
    252268
    253   wid = (int)strtol(args[0], NULL, 0);
     269  wid = (Window)strtol(args[0], NULL, 0);
    254270  x = (int)strtol(args[1], NULL, 0);
    255271  y = (int)strtol(args[2], NULL, 0);
     
    271287  }
    272288
    273   wid = (int)strtol(args[0], NULL, 0);
     289  wid = (Window)strtol(args[0], NULL, 0);
    274290  if (!xdo_window_focus(xdo, wid)) {
    275291    fprintf(stderr, "xdo_window_focus reported an error\n");
     
    288304  }
    289305
    290   wid = (int)strtol(args[0], NULL, 0);
     306  wid = (Window)strtol(args[0], NULL, 0);
    291307  if (!xdo_window_raise(xdo, wid)) {
    292308    fprintf(stderr, "xdo_window_raise reported an error\n");
     
    296312void cmd_windowsize(int argc, char **args) {
    297313  int width, height;
    298   int wid;
     314  Window wid;
    299315  int c;
    300316
     
    328344  }
    329345
    330   wid = (int)strtol(args[0], NULL, 0);
     346  wid = (Window)strtol(args[0], NULL, 0);
    331347  width = (int)strtol(args[1], NULL, 0);
    332348  height = (int)strtol(args[2], NULL, 0);
     
    398414  /* XXX: We shouldn't assume 'Window' == 'int' here... */
    399415  for (i = 0; i < nwindows; i++)
    400     printf("%d\n", (int)list[i]);
     416    window_print(list[i]);
    401417
    402418  /* Free list as it's malloc'd by xdo_window_list_by_regex */
     
    406422/* Added 2007-07-28 - Lee Pumphret */
    407423void cmd_getwindowfocus(int argc, char **args) {
    408   Window window = -1;
     424  Window wid = 0;
    409425  char *cmd = *args;
    410426  argc -= 1;
     
    416432  }
    417433
    418   if (!xdo_window_get_focus(xdo, (int*)&window)) {
     434  if (!xdo_window_get_focus(xdo, &wid)) {
    419435    fprintf(stderr, "xdo_window_focus reported an error\n");
    420436  } else {
    421     printf("%d\n", (int)window);
     437    window_print(wid);
    422438  }
    423439}
     
    434450  }
    435451
    436   wid = (int)strtol(args[0], NULL, 0);
     452  wid = (Window)strtol(args[0], NULL, 0);
    437453  if (!xdo_window_map(xdo, wid)) {
    438454    fprintf(stderr, "xdo_window_map reported an error\n");
     
    451467  }
    452468
    453   wid = (int)strtol(args[0], NULL, 0);
     469  wid = (Window)strtol(args[0], NULL, 0);
    454470  if (!xdo_window_unmap(xdo, wid)) {
    455471    fprintf(stderr, "xdo_window_unmap reported an error\n");
Note: See TracChangeset for help on using the changeset viewer.