return err;
}
-int uxsel_input_add(int fd, int rwx) {
+struct uxsel_id {
+ int id;
+};
+
+uxsel_id *uxsel_input_add(int fd, int rwx) {
+ uxsel_id *id = snew(uxsel_id);
+
int flags = 0;
if (rwx & 1) flags |= GDK_INPUT_READ;
if (rwx & 2) flags |= GDK_INPUT_WRITE;
if (rwx & 4) flags |= GDK_INPUT_EXCEPTION;
assert(flags);
- return gdk_input_add(fd, flags, fd_input_func, NULL);
+ id->id = gdk_input_add(fd, flags, fd_input_func, NULL);
+
+ return id;
}
-void uxsel_input_remove(int id) {
- gdk_input_remove(id);
+void uxsel_input_remove(uxsel_id *id) {
+ gdk_input_remove(id->id);
+ sfree(id);
}
char *setup_fonts_ucs(struct gui_data *inst)
void postmsg(struct termios *);
/* The interface used by uxsel.c */
+typedef struct uxsel_id uxsel_id;
void uxsel_init(void);
typedef int (*uxsel_callback_fn)(int fd, int event);
void uxsel_set(int fd, int rwx, uxsel_callback_fn callback);
int first_fd(int *state, int *rwx);
int next_fd(int *state, int *rwx);
/* The following are expected to be provided _to_ uxsel.c by the frontend */
-int uxsel_input_add(int fd, int rwx); /* returns an id */
-void uxsel_input_remove(int id);
+uxsel_id *uxsel_input_add(int fd, int rwx); /* returns an id */
+void uxsel_input_remove(uxsel_id *id);
/* uxcfg.c */
struct controlbox;
* In Pageant our selects are synchronous, so these functions are
* empty stubs.
*/
-int uxsel_input_add(int fd, int rwx) { return 0; }
-void uxsel_input_remove(int id) { }
+uxsel_id *uxsel_input_add(int fd, int rwx) { return NULL; }
+void uxsel_input_remove(uxsel_id *id) { }
/*
* More stubs.
* In Plink our selects are synchronous, so these functions are
* empty stubs.
*/
-int uxsel_input_add(int fd, int rwx) { return 0; }
-void uxsel_input_remove(int id) { }
+uxsel_id *uxsel_input_add(int fd, int rwx) { return NULL; }
+void uxsel_input_remove(uxsel_id *id) { }
/*
* Short description of parameters.
int fd;
int rwx; /* 4=except 2=write 1=read */
uxsel_callback_fn callback;
- int id; /* for uxsel_input_remove */
+ uxsel_id *id; /* for uxsel_input_remove */
};
static tree234 *fds;
{
struct fd *oldfd = find234(fds, &fd, uxsel_fd_findcmp);
if (oldfd) {
- uxsel_input_remove(oldfd->id);
+ if (oldfd->id)
+ uxsel_input_remove(oldfd->id);
del234(fds, oldfd);
sfree(oldfd);
}
* In PSFTP our selects are synchronous, so these functions are
* empty stubs.
*/
-int uxsel_input_add(int fd, int rwx) { return 0; }
-void uxsel_input_remove(int id) { }
+uxsel_id *uxsel_input_add(int fd, int rwx) { return NULL; }
+void uxsel_input_remove(uxsel_id *id) { }
char *x_get_default(const char *key)
{