URI: 
       ctrlsel.h - ltk - GUI toolkit for X11 (WIP)
  HTML git clone git://lumidify.org/ltk.git (fast, but not encrypted)
  HTML git clone https://lumidify.org/ltk.git (encrypted, but very slow)
  HTML git clone git://4kcetb7mo7hj6grozzybxtotsub5bempzo4lirzc3437amof2c2impyd.onion/ltk.git (over tor)
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
       ctrlsel.h (3176B)
       ---
            1 /*
            2  * MIT/X Consortium License
            3  *
            4  * © 2022-2023 Lucas de Sena <lucas at seninha dot org>
            5  *
            6  * Permission is hereby granted, free of charge, to any person obtaining a
            7  * copy of this software and associated documentation files (the "Software"),
            8  * to deal in the Software without restriction, including without limitation
            9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
           10  * and/or sell copies of the Software, and to permit persons to whom the
           11  * Software is furnished to do so, subject to the following conditions:
           12  *
           13  * The above copyright notice and this permission notice shall be included in
           14  * all copies or substantial portions of the Software.
           15  *
           16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
           17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
           18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
           19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
           20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
           21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
           22  * DEALINGS IN THE SOFTWARE.
           23  */
           24 
           25 /*
           26  * ctrlsel: X11 selection ownership and request helper functions
           27  *
           28  * Refer to the accompanying manual for a description of the interface.
           29  */
           30 #ifndef _CTRLSEL_H_
           31 #define _CTRLSEL_H_
           32 
           33 enum {
           34         CTRLSEL_NONE,
           35         CTRLSEL_INTERNAL,
           36         CTRLSEL_RECEIVED,
           37         CTRLSEL_SENT,
           38         CTRLSEL_DROPSELF,
           39         CTRLSEL_DROPOTHER,
           40         CTRLSEL_ERROR,
           41         CTRLSEL_LOST
           42 };
           43 
           44 enum {
           45         CTRLSEL_COPY    = 0x01,
           46         CTRLSEL_MOVE    = 0x02,
           47         CTRLSEL_LINK    = 0x04,
           48         CTRLSEL_ASK     = 0x08,
           49         CTRLSEL_PRIVATE = 0x10,
           50 };
           51 
           52 typedef struct CtrlSelContext CtrlSelContext;
           53 
           54 struct CtrlSelTarget {
           55         Atom target;
           56         Atom type;
           57         int format;
           58         unsigned int action;
           59         unsigned long nitems;
           60         unsigned long bufsize;
           61         unsigned char *buffer;
           62 };
           63 
           64 void
           65 ctrlsel_filltarget(
           66         Atom target,
           67         Atom type,
           68         int format,
           69         unsigned char *buffer,
           70         unsigned long size,
           71         struct CtrlSelTarget *fill
           72 );
           73 
           74 CtrlSelContext *
           75 ctrlsel_request(
           76         Display *display,
           77         Window window,
           78         Atom selection,
           79         Time time,
           80         struct CtrlSelTarget targets[],
           81         unsigned long ntargets
           82 );
           83 
           84 CtrlSelContext *
           85 ctrlsel_setowner(
           86         Display *display,
           87         Window window,
           88         Atom selection,
           89         Time time,
           90         int ismanager,
           91         struct CtrlSelTarget targets[],
           92         unsigned long ntargets
           93 );
           94 
           95 int ctrlsel_receive(struct CtrlSelContext *context, XEvent *event);
           96 
           97 int ctrlsel_send(struct CtrlSelContext *context, XEvent *event);
           98 
           99 void ctrlsel_cancel(struct CtrlSelContext *context);
          100 
          101 void ctrlsel_disown(struct CtrlSelContext *context);
          102 
          103 CtrlSelContext *
          104 ctrlsel_dndwatch(
          105         Display *display,
          106         Window window,
          107         unsigned int actions,
          108         struct CtrlSelTarget targets[],
          109         unsigned long ntargets
          110 );
          111 
          112 int ctrlsel_dndreceive(struct CtrlSelContext *context, XEvent *event);
          113 
          114 void ctrlsel_dndclose(struct CtrlSelContext *context);
          115 
          116 int
          117 ctrlsel_dndown(
          118         Display *display,
          119         Window window,
          120         Window miniature,
          121         Time time,
          122         struct CtrlSelTarget targets[],
          123         unsigned long ntargets,
          124         CtrlSelContext **context
          125 );
          126 
          127 int ctrlsel_dndsend(struct CtrlSelContext *context, XEvent *event);
          128 
          129 void ctrlsel_dnddisown(struct CtrlSelContext *context);
          130 
          131 #endif /* _CTRLSEL_H_ */