File: atom.go

package info (click to toggle)
golang-github-linuxdeepin-go-x11-client 1.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,784 kB
  • sloc: python: 944; sh: 38; makefile: 17
file content (33 lines) | stat: -rw-r--r-- 726 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

package atom

import (
	x "github.com/linuxdeepin/go-x11-client"
)

func GetVal(conn *x.Conn, name string) (x.Atom, error) {
	reply, err := x.InternAtom(conn, false, name).Reply(conn)
	if err != nil {
		return 0, err
	}
	return reply.Atom, nil
}

func GetExistingVal(conn *x.Conn, name string) (x.Atom, error) {
	reply, err := x.InternAtom(conn, true, name).Reply(conn)
	if err != nil {
		return 0, err
	}
	return reply.Atom, nil
}

func GetName(conn *x.Conn, val x.Atom) (string, error) {
	reply, err := x.GetAtomName(conn, val).Reply(conn)
	if err != nil {
		return "", err
	}
	return reply.Name, nil
}