neuswc

patched neuswc library (tracked)
git clone https://git.daat.foo/neuswc.git
Log | Files | Refs | README | LICENSE

data_device.h (2429B)


      1 /* swc: data_device.h
      2  *
      3  * Copyright (c) 2013-2020 Michael Forney
      4  *
      5  * Permission is hereby granted, free of charge, to any person obtaining a copy
      6  * of this software and associated documentation files (the "Software"), to deal
      7  * in the Software without restriction, including without limitation the rights
      8  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
      9  * copies of the Software, and to permit persons to whom the Software is
     10  * furnished to do so, subject to the following conditions:
     11  *
     12  * The above copyright notice and this permission notice shall be included in
     13  * all copies or substantial portions of the Software.
     14  *
     15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     18  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     20  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
     21  * SOFTWARE.
     22  */
     23 
     24 #ifndef SWC_DATA_DEVICE_H
     25 #define SWC_DATA_DEVICE_H
     26 
     27 #include <stdbool.h>
     28 #include <wayland-server.h>
     29 
     30 enum { DATA_DEVICE_EVENT_SELECTION_CHANGED };
     31 
     32 struct data;
     33 
     34 struct data_device {
     35 	/* The data source corresponding to the current selection. */
     36 	struct wl_resource *selection;
     37 	/* the selection when the compositor keeps it itself, never with selection */
     38 	struct data *host;
     39 	struct wl_listener selection_destroy_listener;
     40 
     41 	struct wl_signal event_signal;
     42 	struct wl_list resources;
     43 };
     44 
     45 struct data_device *
     46 data_device_create(void);
     47 void
     48 data_device_destroy(struct data_device *data_device);
     49 struct wl_resource *
     50 data_device_bind(struct data_device *data_device, struct wl_client *client,
     51                  uint32_t version, uint32_t id);
     52 /* the selection a client set, as data, NULL for none */
     53 struct data *
     54 data_device_client_selection(struct data_device *data_device);
     55 /* takes the selection for the compositor, host owned by the device now. what
     56  * held it is told it is cancelled. a event with data set says it came from
     57  * the compositor and not from a client */
     58 void
     59 data_device_set_host(struct data_device *data_device, struct data *host);
     60 void
     61 data_device_offer_selection(struct data_device *data_device,
     62                             struct wl_client *client);
     63 
     64 #endif