File gmobile-0.4.0.obscpio of Package gmobile

07070100000000000081A40000000000000000000000016857C08300000281000000000000000000000000000000000000001D00000000gmobile-0.4.0/.dir-locals.el(
 (c-mode . (
            (c-file-style . "linux")
            (indent-tabs-mode . nil)
            (c-basic-offset . 2)
            (display-fill-column-indicator-column . 100)
            ))
 (rust-mode . (
            (indent-tabs-mode . nil)
            ))
 (setq auto-mode-alist (cons '("\\.ui$" . nxml-mode) auto-mode-alist))
 (nxml-mode . (
            (indent-tabs-mode . nil)
            ))
 (css-mode . (
            (css-indent-offset . 2)
            ))
 (js-mode . (
             (indent-tabs-mode . nil)
             (js-indent-level . 2)
            ))
 (meson-mode . (
             (indent-tabs-mode . nil)
            ))
)
07070100000001000081A40000000000000000000000016857C083000001E0000000000000000000000000000000000000001C00000000gmobile-0.4.0/.editorconfigroot = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 100

[meson.build]
indent_size = 2
tab_size = 2
indent_style = space

[*.{c,h,c.in,h.in}]
indent_size = 2
tab_size = 2
indent_style = space

[*.css]
indent_size = 2
tab_size = 2
indent_style = space

[*.json]
indent_size = 2
tab_size = 2
indent_style = space

[*.{xml,ui}]
indent_size = 2
tab_size = 2
indent_style = space

[NEWS]
max_line_length = 72
07070100000002000081A40000000000000000000000016857C08300000122000000000000000000000000000000000000001900000000gmobile-0.4.0/.gitignoresubprojects/json-glib/
debian/.debhelper/
debian/debhelper-build-stamp
debian/*.log
debian/*.substvars
debian/files
debian/gir1.2-gm-0/
debian/gmobile-tests/
debian/libgmobile-dev/
debian/libgmobile-examples/
debian/libgmobile-common/
debian/libgmobile0/
debian/libgmobile-doc/
debian/tmp/
07070100000003000041ED0000000000000000000000026857C08300000000000000000000000000000000000000000000001900000000gmobile-0.4.0/.gitlab-ci07070100000004000081A40000000000000000000000016857C08300000DB1000000000000000000000000000000000000001D00000000gmobile-0.4.0/.gitlab-ci.ymlinclude:
 - project: 'guidog/meta-phosh'
   ref: 'a9fef9ad314e8b387fb9b293b9f064527ac0c023'
   file: '/ci/phosh-common-jobs.yml'
 - project: 'Infrastructure/Mirrors/lorry-mirrors/gitlab_freedesktop_org/freedesktop/ci-templates'
   ref: 'b791bd48996e3ced9ca13f1c5ee82be8540b8adb'
   file: '/templates/ci-fairy.yml'

stages:
  - build
  - tests
  - style-checks
  - package
  - deploy

workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
    # Don't trigger a branch pipeline if there is an open MR
    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
      when: never
    - if: $CI_COMMIT_TAG
    - if: $CI_COMMIT_BRANCH

default:
  # Protect CI infra from rogue jobs
  timeout: 15 minutes
  # Allow jobs to be caneled on new commits
  interruptible: true
  # Retry on infra hickups automatically
  retry:
    max: 1
    when:
      - 'api_failure'
      - 'runner_system_failure'
      - 'scheduler_failure'
      - 'stuck_or_timeout_failure'

variables:
  # For ci-fairy
  FDO_UPSTREAM_REPO: World/Phosh/gmobile
  DEPS: >-
    ccache build-essential git gcovr
  DEBIAN_IMAGE: debian:trixie

.before: &before
  - echo "man-db man-db/auto-update boolean false" | debconf-set-selections
  - export DEBIAN_FRONTEND=noninteractive
  - apt-get -y update
  - apt-get -y install eatmydata
  - eatmydata apt-get -y install $DEPS
  - eatmydata apt-get -y build-dep .

.build: &build_steps
    echo "BUILD_OPTS=${BUILD_OPTS}" &&
    export LC_ALL=C.UTF-8 &&
    meson ${BUILD_OPTS} . _build  &&
    ninja -C _build

build-debian-gcc:
  stage: build
  image: $DEBIAN_IMAGE
  variables:
    BUILD_OPTS: -Db_coverage=true --werror
  before_script:
    - *before
  script:
    - *build_steps
  artifacts:
    when: always
    paths:
      - _build

# TODO: move to prebuilt container
doc:
  stage: build
  image: $DEBIAN_IMAGE
  variables:
    BUILD_OPTS: >-
      -Dtests=false
      -Dgtk_doc=true
  before_script:
    - *before
  script:
    - meson ${BUILD_OPTS} _build
    - ninja -C _build
    - mv _build/doc/gmobile-0 _doc/
  artifacts:
    paths:
      - _doc/

tests:
  stage: tests
  image: $DEBIAN_IMAGE
  needs: ['build-debian-gcc']
  before_script:
    - *before
  script:
    - meson ${BUILD_OPTS} _build
    - meson test -C _build
    - ninja -C _build coverage
  coverage: '/^lines:\s+([\d.]+\%)\s+/'
  artifacts:
    reports:
      junit: _build/meson-logs/testlog.junit.xml

# Sanity checks of MR settings and commit logs
sanity:
  extends:
    - .fdo.ci-fairy
  stage: style-checks
  variables:
    GIT_DEPTH: "100"
  needs: []
  script: |
    ci-fairy check-commits --junit-xml=commit-message-junit-report.xml
  artifacts:
    reports:
      junit: commit-message-junit-report.xml
  rules:
    - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME'

format-check:
  stage: style-checks
  extends: .phosh-format-check
  allow_failure: true

check-meson:
  stage: style-checks
  extends:
    - .phosh-check-meson

package-deb-debian-trixie:arm64:
  stage: package
  variables:
    PHOSH_DOCKER_IMAGE: debian:trixie
  extends: .phosh-build-debian-package
  tags:
    - aarch64

render-display-info:
  stage: tests
  image: $DEBIAN_IMAGE
  needs: ['build-debian-gcc']
  before_script:
    - *before
  script:
    - tools/render-all
  artifacts:
    expose_as: 'Display panel html'
    paths:
      - _build/out/

pages:
  stage: deploy
  image: $DEBIAN_IMAGE
  before_script: []
  needs: ['doc']
  script:
    - mv _doc/ public/
  artifacts:
    paths:
      - public
  only:
    - main
07070100000005000081ED0000000000000000000000016857C083000009B1000000000000000000000000000000000000002B00000000gmobile-0.4.0/.gitlab-ci/check-consistency#!/bin/bash
#
# Copyright (C) 2024 The Phosh developers
# SPDX-License-Identifier: GPL-3.0-or-later
# Author: Guido Günther <agx@sigxcpu.org>
#
# Check if NEWS, changelog, meson and metainfo are in sync

set -e

COLOR=
if [ -n "${TERM}" ] && [ "${TERM}" != "dumb" ]; then
  COLOR=1
fi

function log
{
    local level="${1}"
    local fd=2
    local use_color

    shift
    if [ -n "${COLOR}" ]; then
        [ "${level}" == warn ] || [ "${level}" == error ] || fd=1
        ! [ -t "${fd}" ] || use_color=1

        if [ -n "${use_color}" ]; then
            case "${level}" in
                warn)
                    tput setaf 1
                    ;;
                error)
                    tput bold; tput setaf 1
                    ;;
                info)
                    tput setaf 2
                    ;;
            esac
        fi
    fi

    echo "$@"

    [ -z "${use_color}" ] || tput sgr0
}


if [ -f debian/changelog ]; then
    log info "Fetching version from d/changelog"
    VERSION=$(dpkg-parsechangelog -SVersion)
elif [ -f meson.build ]; then
    log info "Fetching version from meson build file"
    VERSION=$(sed -n "s/.*version\s*:\s*'\([0-9].*\)'.*/\1/p" meson.build)
else
    log error "E: Don't know how to get version information"
    exit 1
fi

echo "I: Checking for '${VERSION}'"

# News
if ! head -1 NEWS | grep -E -qs "\s+${VERSION}\s*$"; then
    log error "E: Version ${VERSION} not in NEWS file"
    if [[ "${VERSION}" =~ (~|-)dev ]]; then
        log info "I: Unreleased development version, no need to check NEWS"
    else
        exit 1
    fi
else
    log info "I: Found matching news entry"
fi

# meson.build
MESON_VERSION="${VERSION/\~/.}"
if [ -f meson.build ]; then
    if ! grep -qs "version\s*:\s*'$MESON_VERSION'" meson.build; then
        log error  "E: Version ${MESON_VERSION} not in meson.build file"
        exit 1
    else
        log info "I: Found matching meson version entry"
    fi
else
    log info "I: no meson project"
fi

# appstream info
METAINFO=$(ls data/*metainfo.xml.in* 2>/dev/null || true)
if [ -z "${METAINFO}" ]; then
    log warn "W: No metainfo"
    exit 0
fi

if ! grep -qs "$MESON_VERSION\"" "${METAINFO}"; then
    log error "E: Version ${MESON_VERSION} not in metainfo ${METAINFO}"
    if [[ "${VERSION}" =~ (~|-)(alpha|beta|dev|rc) ]]; then
        log info "I: Not a stable release, no metainfo is fine"
    else
        exit 1
    fi
else
    log info "I: Found matching metainfo entry"
fi
07070100000006000081ED0000000000000000000000016857C083000002ED000000000000000000000000000000000000002500000000gmobile-0.4.0/.gitlab-ci/check-meson#!/bin/bash
#
# Copyright (C) 2025 The Phosh developers
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Author: Guido Günther <agx@sigxcpu.org>

ret=0

TMPDIR=$(mktemp -d)

# We check files individually so we can print the diff:
while IFS= read -r -d '' file; do
  if ! meson format -e --check-only "$file"; then
     echo
     echo "Meson file '${file}' needs reformat:"
     meson format -e "$file" > "${TMPDIR}/meson.build"
     diff -u "$file" "${TMPDIR}/meson.build"
     rm -f "${TMPDIR}/meson.build"
     ret=1
  fi
done <  <(find . -name '*.build' -print0)

if [ -n "$TMPDIR" ]; then
    rmdir "${TMPDIR}"
fi

if [ $ret -ne 0 ]; then
    cat <<EOF

To reformat all files run:

    meson format -e --recursive --inplace

EOF
fi

exit $ret
07070100000007000081ED0000000000000000000000016857C08300000264000000000000000000000000000000000000002200000000gmobile-0.4.0/.gitlab-ci/check-po#!/bin/bash
#
# Copyright (C) 2024 The Phosh developers
# SPDX-License-Identifier: GPL-3.0-or-later
# Author: Guido Günther <agx@sigxcpu.org>

cd po/ || exit 1
# barf on untranslated C files. Seems intltool
# can't be told to exit with non-zero exit status
# in this case

if intltool-update -m 2>&1 | grep -E -qs '/.*\.(c|ui|in)'; then
  intltool-update -m
  exit 1
fi

# Check for broken po files
for file in *.po; do
  echo -n "Checking ${file}: "
  msgfmt -v -c "${file}"
  # Check for errors, msgfmt returns 0 on errors too
  if msgfmt -c "${file}" 2>&1 | grep -qs 'fatal error'; then
    exit 1
  fi
done
07070100000008000081ED0000000000000000000000016857C0830000153B000000000000000000000000000000000000002800000000gmobile-0.4.0/.gitlab-ci/check-style.py#!/bin/env python3
#
# Based on check-style.py by
# Carlos Garnacho <carlosg@gnome.org>

import argparse
import os
import re
import subprocess
import sys
import tempfile

# Path relative to this script
uncrustify_cfg = ".gitlab-ci/uncrustify.cfg"


def run_diff(sha):
    proc = subprocess.run(
        ["git", "diff", "-U0", "--function-context", sha, "HEAD"],
        stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT,
        encoding="utf-8",
    )
    return proc.stdout.strip().splitlines()


def find_chunks(diff):
    file_entry_re = re.compile(r"^\+\+\+ b/(.*)$")
    diff_chunk_re = re.compile(r"^@@ -\d+,\d+ \+(\d+),(\d+)")
    file = None
    chunks = []

    for line in diff:
        match = file_entry_re.match(line)
        if match:
            file = match.group(1)

        match = diff_chunk_re.match(line)
        if match:
            start = int(match.group(1))
            len = int(match.group(2))
            end = start + len

            if len > 0 and (
                file.endswith(".c") or file.endswith(".h") or file.endswith(".vala")
            ):
                chunks.append({"file": file, "start": start, "end": end})

    return chunks


def reformat_chunks(chunks, rewrite, dry_run):
    # Creates temp file with INDENT-ON/OFF comments
    def create_temp_file(file, start, end):
        with open(file) as f:
            tmp = tempfile.NamedTemporaryFile()
            if start > 1:
                tmp.write(b"/** *INDENT-OFF* **/\n")
            for i, line in enumerate(f, start=1):
                if i == start - 1:
                    tmp.write(b"/** *INDENT-ON* **/\n")

                tmp.write(bytes(line, "utf-8"))
                if i == end - 1:
                    tmp.write(b"/** *INDENT-OFF* **/\n")
            tmp.seek(0)
        return tmp

    # Removes uncrustify INDENT-ON/OFF helper comments
    def remove_indent_comments(output):
        tmp = tempfile.NamedTemporaryFile()
        for line in output:
            if line != b"/** *INDENT-OFF* **/\n" and line != b"/** *INDENT-ON* **/\n":
                tmp.write(line)

        tmp.seek(0)
        return tmp

    changed = None
    for chunk in chunks:
        # Add INDENT-ON/OFF comments
        tmp = create_temp_file(chunk["file"], chunk["start"], chunk["end"])

        # uncrustify chunk
        proc = subprocess.run(
            ["uncrustify", "-c", uncrustify_cfg, "-f", tmp.name],
            stdout=subprocess.PIPE,
        )
        reindented = proc.stdout.splitlines(keepends=True)
        if proc.returncode != 0:
            continue

        tmp.close()

        # Remove INDENT-ON/OFF comments
        formatted = remove_indent_comments(reindented)

        if dry_run is True:
            # Show changes
            proc = subprocess.run(
                ["diff", "-up", "--color=always", chunk["file"], formatted.name],
                stdout=subprocess.PIPE,
                stderr=subprocess.STDOUT,
                encoding="utf-8",
            )
            diff = proc.stdout
            if diff != "":
                output = re.sub("\t", "↦\t", diff)
                print(output)
                changed = True
        else:
            # Apply changes
            diff = subprocess.run(
                ["diff", "-up", chunk["file"], formatted.name],
                stdout=subprocess.PIPE,
                stderr=subprocess.STDOUT,
            )
            subprocess.run(["patch", chunk["file"]], input=diff.stdout)

        formatted.close()

    return changed


def main(argv):
    parser = argparse.ArgumentParser(
        description="Check code style. Needs uncrustify installed."
    )
    parser.add_argument(
        "--sha", metavar="SHA", type=str, help="SHA for the commit to compare HEAD with"
    )
    parser.add_argument(
        "--dry-run",
        "-d",
        type=bool,
        action=argparse.BooleanOptionalAction,
        help="Only print changes to stdout, do not change code",
    )
    parser.add_argument(
        "--rewrite",
        "-r",
        type=bool,
        action=argparse.BooleanOptionalAction,
        help="Whether to amend the result to the last commit (e.g. 'git rebase --exec \"%(prog)s -r\"')",
    )

    if not os.path.exists(".git"):
        print("Not in toplevel of a git repository", fille=sys.stderr)
        return 1

    args = parser.parse_args(argv)
    sha = args.sha or "HEAD^"

    diff = run_diff(sha)
    chunks = find_chunks(diff)
    changed = reformat_chunks(chunks, args.rewrite, args.dry_run)

    if args.dry_run is not True and args.rewrite is True:
        proc = subprocess.run(["git", "add", "-p"])
        if proc.returncode == 0:
            # Commit the added changes as a squash commit
            subprocess.run(
                ["git", "commit", "--squash", "HEAD", "-C", "HEAD"],
                stdout=subprocess.DEVNULL,
            )
            # Delete the unapplied changes
            subprocess.run(["git", "reset", "--hard"], stdout=subprocess.DEVNULL)
            return 0
    elif args.dry_run is True and changed is True:
        print(
            f"""
Issue the following commands in your local tree to apply the suggested changes:

    $ git rebase {sha} --exec "./.gitlab-ci/check-style.py -r"
    $ git rebase --autosquash {sha}

Don't trust uncrustify unconditionally.
"""
        )
        return 1
    return 0


if __name__ == "__main__":
    sys.exit(main(sys.argv[1:]))
07070100000009000081A40000000000000000000000016857C083000003BA000000000000000000000000000000000000002A00000000gmobile-0.4.0/.gitlab-ci/commit-rules.ymlpatterns:
  deny:
    - regex: '^$CI_MERGE_REQUEST_PROJECT_URL/(-/)?merge_requests/$CI_MERGE_REQUEST_IID$'
      message: Commit message must not contain a link to its own merge request
    - regex: '^[^:]+: [a-z]'
      message: "Commit description in commit message subject should be properly Capitalized. E.g. 'monitor: Avoid crash on unplug'"
      where: subject
    - regex: '^\S*\.(c|h|ui):'
      message: Commit message subject prefix should not include .c, .h etc.
      where: subject
    - regex: '([^.]\.|[:,;])\s*$'
      message: Commit message subject should not end with punctuation
      where: subject
    - regex: '^[A-Z]\S*:'
      message: "Identifier in commit message subject should start lowercase 'monitor: Avoid crash on unplug'"
      where: subject
  require:
    - regex: '^[a-z0-9,\.\+\-/#=_]+:'
      message: "Commit message should start with a lowercase identifier 'monitor: Avoid crash on unplug'"
      where: subject
0707010000000A000081A40000000000000000000000016857C08300001492000000000000000000000000000000000000002800000000gmobile-0.4.0/.gitlab-ci/uncrustify.cfg#
# Uncrustify config for phosh and related projects
#

# A span is the number of lines considered
# A threshold is the maximum number of columns an item is moved

# Indent by two spaces
indent_columns                  = 2
# No tabs
indent_with_tabs                = 0
# Line length
code_width                      = 100
# Whether to remove superfluous semicolons
mod_remove_extra_semicolon      = true
# indent goto by 1 (or -1 brace level)
indent_label                    = -1
# don't indent case after switch
indent_switch_case              = 0

#
# Keywords and operators
#
# Add between 'do' and '{'.
sp_do_brace_open                = add
# Add space between '}' and 'while'.
sp_brace_close_while            = add
# Add 'while' and '('.
sp_while_paren_open             = add
# Add or remove space around boolean operators '&&' and '||'.
sp_bool                         = add
# Ternary operator
sp_cond_ternary_short           = remove
# Remove newline between 'struct and '{'.
nl_struct_brace                 = remove
# Remove newline between 'if' and '{'.
nl_if_brace                     = remove
# Remove newline between '}' and 'else'.
nl_brace_else                   = remove
# Remove newline between 'else' and '{'.
nl_else_brace                   = remove
# Remove newline between 'else' and 'if'.
nl_else_if                      = remove
# Add or remove newline between 'for' and '{'.
nl_for_brace                    = remove
# Add or remove newline between 'while' and '{'.
nl_while_brace                  = remove
# Treat iterators as for loops:
set FOR wl_list_for_each wl_list_for_each_reverse wl_list_for_each_safe
# Remove braces on single line if/for/while statements
mod_full_brace_if               = remove
mod_full_brace_for              = remove
mod_full_brace_while            = remove
# If any must be braced, they are all braced.  If all can be unbraced, then the braces are removed.
mod_full_brace_if_chain         = 1
# Remove braces around case (when there are no variables declarations)
mod_case_brace                  = remove
# Don't remove branches if the statement has more than one line
mod_full_brace_nl               = 2

#
# Function declarations, definitions and calls
#
# Add space between function name and '(' on function declaration.
sp_func_proto_paren             = add
# Add or remove space between function name and '()' on function declaration
# without parameters.
sp_func_proto_paren_empty       = add
# Add space between function name and '(' on function definition.
sp_func_def_paren               = add
# Add or remove space between function name and '(' on function calls.
sp_func_call_paren              = add
# Specialcase i18n macros
set func_call_user               _ N_ C_
sp_func_call_user_paren         = remove

# Whether to force indentation of function definitions to start in column 1.
indent_func_def_force_col1      = true
# Add newline between return type and function name in a function definition.
nl_func_type_name               = add
# Add newline between function signature and '{'.
nl_fdef_brace                   = add
# Whether to align variable definitions in prototypes and functions.
align_func_params               = true
# The span for aligning function prototypes.
align_func_proto_span           = 8
# Add space between 'decltype(...)' and word.
sp_after_decltype               = add
# Add or remove space after a pointer star '*', if followed by a function
# prototype or function definition.
sp_after_ptr_star_func          = remove
# Add or remove newline between a function call's ')' and '{', as in
# 'list_for_each(item, &list) { }'.
nl_fcall_brace                  = add

#
# Typedefs
#
# Add space between '}' and the name of a typedef on the same line.
sp_brace_typedef                = add

#
# Comments
#
# Add space after the opening of a C++ comment, i.e. '// A' vs. '//A'.
sp_cmt_cpp_start                = add

#
# Preprocessor
#
# Add or remove space between #else or #endif and a trailing comment.
sp_endif_cmt                    = add
# Offset value that controls the indentation of the body of a multiline #define
pp_multiline_define_body_indent = 2

# Newlines at the start and end of the file.
nl_start_of_file                = remove
nl_end_of_file                  = add
nl_end_of_file_min              = 1

#
# Variable definitions
#
# How to align the '*' in variable definitions.
#
# 0: Part of the type     'void *   foo;' (default)
# 1: Part of the variable 'void     *foo;'
# 2: Dangling             'void    *foo;'
# Dangling: the '*' will not be taken into account when aligning.
align_var_def_star_style        = 2
# Same for typedefs
align_typedef_star_style        = 2
# The gap for aligning struct/union member definitions.
align_var_struct_gap            = 1
# The span for aligning struct/union member definitions.
align_var_struct_span           = 4
# The threshold for aligning struct/union member definitions.
align_var_struct_thresh         = 8

# Remove space between pointer stars '*'.
sp_between_ptr_star             = remove
# Add space before '(' of control statements ('if', 'for', 'switch', 'while', etc.)
sp_before_sparen                = add

# Add spaces around assignments and arithmethic operators
sp_assign = add
sp_arith = add

0707010000000B000081A40000000000000000000000016857C0830000894B000000000000000000000000000000000000001600000000gmobile-0.4.0/COPYING                    GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU General Public License is a free, copyleft license for
software and other kinds of works.

  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.  We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors.  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

  To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights.  Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received.  You must make sure that they, too, receive
or can get the source code.  And you must show them these terms so they
know their rights.

  Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.

  For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software.  For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.

  Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so.  This is fundamentally incompatible with the aim of
protecting users' freedom to change the software.  The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable.  Therefore, we
have designed this version of the GPL to prohibit the practice for those
products.  If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.

  Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary.  To prevent this, the GPL assures that
patents cannot be used to render the program non-free.

  The precise terms and conditions for copying, distribution and
modification follow.

                       TERMS AND CONDITIONS

  0. Definitions.

  "This License" refers to version 3 of the GNU General Public License.

  "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.

  To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.

  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.

  To "convey" a work means any kind of propagation that enables other
parties to make or receive copies.  Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.

  An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License.  If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

  1. Source Code.

  The "source code" for a work means the preferred form of the work
for making modifications to it.  "Object code" means any non-source
form of a work.

  A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.

  The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form.  A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.

  The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities.  However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work.  For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.

  The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.

  The Corresponding Source for a work in source code form is that
same work.

  2. Basic Permissions.

  All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met.  This License explicitly affirms your unlimited
permission to run the unmodified Program.  The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work.  This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.

  You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force.  You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright.  Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.

  Conveying under any other circumstances is permitted solely under
the conditions stated below.  Sublicensing is not allowed; section 10
makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

  No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.

  When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.

  4. Conveying Verbatim Copies.

  You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.

  You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

  You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.

    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit.  Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.

  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge.  You need not require recipients to copy the
    Corresponding Source along with the object code.  If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source.  Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.

    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

  A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.

  A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling.  In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage.  For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product.  A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.

  "Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source.  The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.

  If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information.  But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).

  The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.

  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.

  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.

  When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it.  (Additional permissions may be written to require their own
removal in certain cases when you modify the work.)  You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.

  Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.

  All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10.  If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term.  If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.

  If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.

  Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.

  8. Termination.

  You may not propagate or modify a covered work except as expressly
provided under this License.  Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).

  However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.

  Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.

  Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License.  If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.

  9. Acceptance Not Required for Having Copies.

  You are not required to accept this License in order to receive or
run a copy of the Program.  Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance.  However,
nothing other than this License grants you permission to propagate or
modify any covered work.  These actions infringe copyright if you do
not accept this License.  Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.

  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.

  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.

  You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License.  For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.

  11. Patents.

  A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based.  The
work thus licensed is called the contributor's "contributor version".

  A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version.  For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.

  Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.

  In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement).  To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.

  If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients.  "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.

  If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.

  A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License.  You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.

  Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.

  12. No Surrender of Others' Freedom.

  If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all.  For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.

  13. Use with the GNU Affero General Public License.

  Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work.  The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.

  14. Revised Versions of this License.

  The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation.  If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.

  If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.

  Later license versions may give you additional or different
permissions.  However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

  15. Disclaimer of Warranty.

  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. Limitation of Liability.

  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

  17. Interpretation of Sections 15 and 16.

  If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

  If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

    <program>  Copyright (C) <year>  <name of author>
    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".

  You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.

  The GNU General Public License does not permit incorporating your program
into proprietary programs.  If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library.  If this is what you want to do, use the GNU Lesser General
Public License instead of this License.  But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
0707010000000C000081A40000000000000000000000016857C083000067A2000000000000000000000000000000000000001A00000000gmobile-0.4.0/COPYING.LIB                  GNU LESSER GENERAL PUBLIC LICENSE
                       Version 2.1, February 1999

 Copyright (C) 1991, 1999 Free Software Foundation, Inc.
 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

[This is the first released version of the Lesser GPL.  It also counts
 as the successor of the GNU Library Public License, version 2, hence
 the version number 2.1.]

                            Preamble

  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.

  This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it.  You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.

  When we speak of free software, we are referring to freedom of use,
not price.  Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.

  To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights.  These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.

  For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you.  You must make sure that they, too, receive or can get the source
code.  If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it.  And you must show them these terms so they know their rights.

  We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.

  To protect each distributor, we want to make it very clear that
there is no warranty for the free library.  Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.

  Finally, software patents pose a constant threat to the existence of
any free program.  We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder.  Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.

  Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License.  This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License.  We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.

  When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library.  The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom.  The Lesser General
Public License permits more lax criteria for linking other code with
the library.

  We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License.  It also provides other free software developers Less
of an advantage over competing non-free programs.  These disadvantages
are the reason we use the ordinary General Public License for many
libraries.  However, the Lesser license provides advantages in certain
special circumstances.

  For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard.  To achieve this, non-free programs must be
allowed to use the library.  A more frequent case is that a free
library does the same job as widely used non-free libraries.  In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.

  In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software.  For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.

  Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.

  The precise terms and conditions for copying, distribution and
modification follow.  Pay close attention to the difference between a
"work based on the library" and a "work that uses the library".  The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.

                  GNU LESSER GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".

  A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.

  The "Library", below, refers to any such software library or work
which has been distributed under these terms.  A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language.  (Hereinafter, translation is
included without limitation in the term "modification".)

  "Source code" for a work means the preferred form of the work for
making modifications to it.  For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.

  Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it).  Whether that is true depends on what the Library does
and what the program that uses the Library does.

  1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.

  You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.

  2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

    a) The modified work must itself be a software library.

    b) You must cause the files modified to carry prominent notices
    stating that you changed the files and the date of any change.

    c) You must cause the whole of the work to be licensed at no
    charge to all third parties under the terms of this License.

    d) If a facility in the modified Library refers to a function or a
    table of data to be supplied by an application program that uses
    the facility, other than as an argument passed when the facility
    is invoked, then you must make a good faith effort to ensure that,
    in the event an application does not supply such function or
    table, the facility still operates, and performs whatever part of
    its purpose remains meaningful.

    (For example, a function in a library to compute square roots has
    a purpose that is entirely well-defined independent of the
    application.  Therefore, Subsection 2d requires that any
    application-supplied function or table used by this function must
    be optional: if the application does not supply it, the square
    root function must still compute square roots.)

These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.

In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

  3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library.  To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License.  (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.)  Do not make any other change in
these notices.

  Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.

  This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.

  4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.

  If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.

  5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library".  Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.

  However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library".  The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.

  When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library.  The
threshold for this to be true is not precisely defined by law.

  If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work.  (Executables containing this object code plus portions of the
Library will still fall under Section 6.)

  Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.

  6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.

  You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License.  You must supply a copy of this License.  If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License.  Also, you must do one
of these things:

    a) Accompany the work with the complete corresponding
    machine-readable source code for the Library including whatever
    changes were used in the work (which must be distributed under
    Sections 1 and 2 above); and, if the work is an executable linked
    with the Library, with the complete machine-readable "work that
    uses the Library", as object code and/or source code, so that the
    user can modify the Library and then relink to produce a modified
    executable containing the modified Library.  (It is understood
    that the user who changes the contents of definitions files in the
    Library will not necessarily be able to recompile the application
    to use the modified definitions.)

    b) Use a suitable shared library mechanism for linking with the
    Library.  A suitable mechanism is one that (1) uses at run time a
    copy of the library already present on the user's computer system,
    rather than copying library functions into the executable, and (2)
    will operate properly with a modified version of the library, if
    the user installs one, as long as the modified version is
    interface-compatible with the version that the work was made with.

    c) Accompany the work with a written offer, valid for at
    least three years, to give the same user the materials
    specified in Subsection 6a, above, for a charge no more
    than the cost of performing this distribution.

    d) If distribution of the work is made by offering access to copy
    from a designated place, offer equivalent access to copy the above
    specified materials from the same place.

    e) Verify that the user has already received a copy of these
    materials or that you have already sent this user a copy.

  For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it.  However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.

  It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system.  Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.

  7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:

    a) Accompany the combined library with a copy of the same work
    based on the Library, uncombined with any other library
    facilities.  This must be distributed under the terms of the
    Sections above.

    b) Give prominent notice with the combined library of the fact
    that part of it is a work based on the Library, and explaining
    where to find the accompanying uncombined form of the same work.

  8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License.  Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License.  However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.

  9. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Library or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.

  10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.

  11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all.  For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.

If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

  12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded.  In such case, this License incorporates the limitation as if
written in the body of this License.

  13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number.  If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation.  If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.

  14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission.  For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this.  Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.

                            NO WARRANTY

  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.

                     END OF TERMS AND CONDITIONS

           How to Apply These Terms to Your New Libraries

  If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change.  You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).

  To apply these terms, attach the following notices to the library.  It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.

    <one line to give the library's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

Also add information on how to contact you by electronic and paper mail.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary.  Here is a sample; alter the names:

  Yoyodyne, Inc., hereby disclaims all copyright interest in the
  library `Frob' (a library for tweaking knobs) written by James Random Hacker.

  <signature of Ty Coon>, 1 April 1990
  Ty Coon, President of Vice

That's all there is to it!
0707010000000D000081A40000000000000000000000016857C08300001066000000000000000000000000000000000000001300000000gmobile-0.4.0/NEWSgmobile 0.4.0
-------------
Released June 2025
* Add MCC to ISO country code conversion.
* Wakeup key support for:
  * Fairphone 5
  * FuriPhone FLX1
* Display panel support for:
  * Fix border radius for OnePlus6
* Contributors:
    * Bardia Moshiri
    * Evangelos Ribeiro Tzaras
    * fossdd
    * Guido Günther

gmobile 0.3.0
-------------
Released May 2025
* New API: Allow to set wakep timers
* Build vapi files too
* Allow to install tests
* Wakeup key support:
  * Handle 3.5mm headset play-pause button on PinePhone
* Contributors:
    * Adam
    * Guido Günther

gmobile 0.2.2
-------------
Released March 2025
* Wakeup key support for:
  * Google Pixel 3a (sargo)
  * SHIFT6mq
  * Samsung Galaxy A5
  * Xioami Mi A2 Lite (daisy)
* Display panel support for:
  * Furilabs FLX1
  * Nothing Phone 1 (spacewar)
* Issues fixed:
    * https://gitlab.gnome.org/World/Phosh/gmobile/-/issues/12
* Contributors:
    * Eugene Lepshy
    * Evangelos Ribeiro Tzaras
    * Guido Günther
    * Rafael Fontenelle
    * Sam Day

gmobile 0.2.1
-------------
Released: June 2024
* New hwdb entries:
    * Generic AVRCP bluetooth (e.g. Headsets with volume buttons)
    * Juno Tablets
    * OnePlus 6/6T
    * Pine64 Pinephone Pro
* Updated hwdb entries:
    * Pine64 PinePhone
* Simplify the run-phosh helper to test notch information
* Contributors:
    * Arnaud Ferraris
    * Giovanni Caligaris
    * Guido Günther
    * Philip Hands
* Issues fixed:
    * https://gitlab.gnome.org/World/Phosh/gmobile/-/issues/7

gmobile 0.2.0
-------------
Released: May 2024
* Add hwdb for wakeup keys that allow e.g. Wayland compositors to figure out
  whether a key should unblank the screen. See gmobile.udev(5) for details.
* Contributors:
    * Guido Günther
    * nee

gmobile 0.1.0
-------------
Released: March 2024
* Split public and private headers
* Improve API docs
* Use GSourceOnceFunc for `_once` functions
  This is a slight API break.
* Install shared library with .0 soname
* Make JSON files compatible with recent json-glib
* Added devices:
  * Xiaomi Mi A2 Lite
* Issues fixed:
  * https://gitlab.gnome.org/World/Phosh/gmobile/-/issues/4
* Contributors:
    * Andrea Bolognani
    * Guido Günther

gmobile 0.0.6
-------------
Released: February 2024
* Build a shared library for testing purposes.
* Added devices:
  * Daria Bond
  * Gigaset GS5
  * Gigaset GX4
  * Google Pixel 6
  * Google Pixel 6 Pro
  * Motorola ThinkPhone
  * Volla Phone 22
  * Volla Phone X23
  * Xiaomi POCO M2 Pro
  * Xiaomi Redmi 7
  * Xiaomi Redmi 9C
  * Xiaomi Redmi 9C NFC
  * Xiaomi Redmi Note 7
  * Xiaomi Redmi Note 9 Pro
  * Xiaomi Redmi Note 9 Pro Max
  * Xiaomi Redmi Note 9S
* Updated devies:
  * Xiaomi Redmi 9A
* Contributors:
    * Bardia Moshiri
    * Guido Günther

gmobile 0.0.5
-------------
Released: January 2024
* Fix build on FreeBSD
* Add new macros to check for empty string types
* Added devices:
  * Fairphone 5
* Updated devices:
  * Fairphone 4
* Contributors:
    * Arnaud Ferraris
    * Guido Günther
    * Jan Beich
    * Luca Weiss

gmobile 0.0.4
-------------
Released: October 2023
* Add helper to render all display infos
* Added devices:
    * Xiaomi Dandelion
* Contributors:
    * darkc0der
    * Guido Günther

gmobile 0.0.3
-------------
Released: August 2023
* Fix Librem 5 device information

gmobile 0.0.2
-------------
Released: July 2023
* New tools:
  gm-display-panel-run-phosh: Run a nested phosh and phoc emulating the
  given device and enable cutout overlay rendering
* Added devices:
  * Fairphone 4
  * Xiaomi Poco F1
* No API changes
* Contributors:
  * Guido Günther
  * Luca Weiss
  * Suraj Kumar Mahto

gmobile 0.0.1
-------------
Released: January 2023
* Initial release (no API guarantees!)
* New API:
  - GmSvgPath: Store SVG path and get it's bounds
  - GmRect: Simple rectangle
  - GmCutout: A display cutout or notch
  - GmDisplayPanel: Describes a display panel
  - GmDeviceInfo: Retrieve device information
* New tools:
  - gm-display-panel-preview: Generate SVGs and HTML to visualize a device's
    panel
* Added devices:
  - Librem 5
  - OnePlus 6
  - OnePlust 6T
* API changes:
  gm_device_tree_get_compatibles -> gm_devicetree_get_compatibles
0707010000000E000081A40000000000000000000000016857C08300000554000000000000000000000000000000000000001800000000gmobile-0.4.0/README.md# gmobile

gmobile carries some helpers for glib based environments on mobile devices.
Some of those parts might move to glib or libgnome-desktop eventually. It can
be used as a shared library or git submodule. There aren't any API stability
guarantees at this point in time.

## License

gmobile is licensed under the GPL-3-or-later and LGPLv2.1-or-later.

## Getting the source

```sh
    git clone https://gitlab.gnome.org/World/Phosh/gmobile.git
    cd gmobile.git
```

The `main` branch has the current development version.

## Dependencies

See `meson.build` for required dependencies.

## Building

We use the meson (and thereby Ninja) build system for gmobile.  The quickest
way to get going is to do the following:

```sh
    meson setup _build
    meson compile -C _build
```

# API docs
API documentation is available at https://world.pages.gitlab.gnome.org/Phosh/gmobile/

# Adding a new device
If you want to add display panel information for a new device see
this post on [notch support](https://phosh.mobi/posts/notch-support/).

If you want to add support for wakeup keys see the
[manpage](./doc/gmobile.udev.rst) and the post on [wakeup keys][].

# Getting in Touch
* Issue tracker: https://gitlab.gnome.org/World/Phosh/gmobile/-/issues
* Matrix: https://im.puri.sm/#/room/#phosh:talk.puri.sm

[wakeup keys]: https://phosh.mobi/posts/wakeup-keys/
0707010000000F000041ED0000000000000000000000026857C08300000000000000000000000000000000000000000000001300000000gmobile-0.4.0/data07070100000010000081A40000000000000000000000016857C083000016D4000000000000000000000000000000000000002A00000000gmobile-0.4.0/data/61-gmobile-wakeup.hwdb# Copyright 2024 The Phosh Developers
#
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# This file is part of gmobile.
#
# This file contains metadata to apply to keyboards and
# keyboard-like input devices:
#
# - Wakeup keys used for unidling a device
#
# ########################### MATCHING #######################################
#
# The lookup keys are composed in:
#    61-gmobile-rules
#
# Supported hardware matches are:
#
#  - AT keyboard DMI data matches:
#      evdev:atkbd:dmi:bvn*:bvr*:bd*:svn<vendor>:pn<product>:pvr*
#    <vendor> and <product> are the firmware-provided strings
#    exported by the kernel DMI modalias, see /sys/class/dmi/id/modalias.
#
#  - Input driver device name and DMI data match:
#      evdev:name:<input device name>:dmi:bvn*:bvr*:bd*:svn<vendor>:pn*
#    <input device name> is the name of the device specified by the
#    driver, <vendor> is the firmware-provided string exported
#    by the kernel DMI modalias, see /sys/class/dmi/id/modalias
#
#  - Input driver device name and device tree compatible match
#      evdev:name:<input device name>:dt:<compatible>*
#    <input device name> is the name device specified by the
#    driver, <model> is the first entry of the device tree's compatible
#    string from /sys/firmware/devicetree/base/compatible.
#
# Note that the format of this file might change without notice so device
# specific rules should be submitted to gmobile upstream so they can be kept
# in sync.

# ######################### WAKEUP KEYS ######################################
#
# The wakeup keys specify which keys unblank the screen of an idle device. By
# default all keys are wakeup keys The default can be changed on a per keyboard
# basis via
#  GM_WAKEUP_KEY_DEFAULT=0
# The behaviour of individual keys can be changed by giving their keycodes e.g.
#  GM_WAKEUP_KEY_114=0
#  GM_WAKEUP_KEY_115=0
# would remove the volume keys from the list of wakeup keys

###########################################################
# Fairphone
###########################################################

# Fairphone 5
gmobile:name:pmic_resin:dt:fairphone,fp5*
 GM_WAKEUP_KEY_114=0

gmobile:name:gpio-keys:dt:fairphone,fp5*
 GM_WAKEUP_KEY_115=0

###########################################################
# FuriLabs
###########################################################

# FuriLabs FuriPhone FLX1. 114,115 are the volume keys, 112 is assistant button
gmobile:name:mtk-kpd:dt:furilabs,flx1*
 GM_WAKEUP_KEY_112=0
 GM_WAKEUP_KEY_114=0
 GM_WAKEUP_KEY_115=0

###########################################################
# Generic AVRCP bluetooth hardware
###########################################################
gmobile:name:* _AVRCP_:*
 GM_WAKEUP_KEY_DEFAULT=0

###########################################################
# Google
###########################################################

# Pixel 3a (Sargo)
gmobile:name:pm8941_resin:dt:google,sargo*
 GM_WAKEUP_KEY_114=0

gmobile:name:gpio-keys:dt:google,sargo*
 GM_WAKEUP_KEY_115=0

###########################################################
# Juno Computers
###########################################################

# Juno Tab 1 tablet. 114,115 are the volume keys
gmobile:name:Intel HID events:dmi:bvnAmericanMegatrendsInternational,LLC.:bvrJP2V*:svnDefaultstring:*
 GM_WAKEUP_KEY_114=0
 GM_WAKEUP_KEY_115=0

# Juno Tab 2 tablet. 114,115 are the volume keys
gmobile:atkbd:dmi:bvnAmericanMegatrendsInternational,LLC.:bvr*:svnDigitek:*
 GM_WAKEUP_KEY_114=0
 GM_WAKEUP_KEY_115=0

# Juno Tab 3 tablet. 114,115 are the volume keys
gmobile:atkbd:dmi:bvnAmericanMegatrendsInternational,LLC.:bvr*:svnJunoComputers:pnjunotab3:*
 GM_WAKEUP_KEY_114=0
 GM_WAKEUP_KEY_115=0

###########################################################
# OnePlus
###########################################################

# OnePlus 6
gmobile:name:Volume keys:dt:oneplus,enchilada*
 GM_WAKEUP_KEY_DEFAULT=0

# OnePlus 6T
gmobile:name:Volume keys:dt:oneplus,fajita*
 GM_WAKEUP_KEY_DEFAULT=0

###########################################################
# Pine64
###########################################################

# PinePhone
gmobile:name:1c21800.lradc:dt:pine64,pinephone-1.*
 GM_WAKEUP_KEY_DEFAULT=0

gmobile:name:PinePhone 1c22e00.codec-jack:dt:pine64,pinephone-1.*
 GM_WAKEUP_KEY_164=0

# PinePhone Pro
gmobile:name:adc-keys:dt:pine64,pinephone-pro*
 GM_WAKEUP_KEY_DEFAULT=0

###########################################################
# Purism
###########################################################

# Purism Librem 11 tablet. 114,115 are the volume keys
gmobile:atkbd:dmi:bvn*:bvr*:svnPurism:pnLibrem11:*
 GM_WAKEUP_KEY_114=0
 GM_WAKEUP_KEY_115=0

# Purism Librem 5 phone. 114,115 are the volume keys
gmobile:name:gpio-keys:dt:purism,librem5*
 GM_WAKEUP_KEY_114=0
 GM_WAKEUP_KEY_115=0

###########################################################
# Samsung
###########################################################

# Samsung Galaxy A5 (A500F*). tm2-touchkey is capacitative buttons
# 114+115 are volume buttons
gmobile:name:GPIO Buttons:dt:samsung,a5*
  GM_WAKEUP_KEY_115=0

gmobile:name:tm2-touchkey:dt:samsung,a5*
  GM_WAKEUP_KEY_DEFAULT=0

gmobile:name:pm8941_resin:dt:samsung,a5*
  GM_WAKEUP_KEY_114=0

###########################################################
# SHIFT GmbH
###########################################################

# SHIFT6mq phone. 114,115 are volume keys
gmobile:name:pm8941_resin:dt:shift,axolotl*
 GM_WAKEUP_KEY_114=0

gmobile:name:gpio-keys:dt:shift,axolotl*
 GM_WAKEUP_KEY_115=0

###########################################################
# Xiaomi
###########################################################

# Xiaomi Mi A2 Lite (xiaomi-daisy). 114+115 are volume buttons
gmobile:name:gpio-keys:dt:xiaomi,daisy*
 GM_WAKEUP_KEY_115=0

gmobile:name:pm8941_resin:dt:xioami,daisy*
 GM_WAKEUP_KEY_114=0
07070100000011000081A40000000000000000000000016857C0830000036C000000000000000000000000000000000000002400000000gmobile-0.4.0/data/61-gmobile.rules# Copyright 2024 The Phosh Developers
#
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# This file is part of gmobile.
#
# Do not edit this file, it will be overwritten on update

ACTION=="remove", GOTO="gmobile_end"
KERNEL!="event*", GOTO="gmobile_end"

# AT keyboard matching by the machine's DMI data
DRIVERS=="atkbd", \
  IMPORT{builtin}="hwdb 'gmobile:atkbd:$attr{[dmi/id]modalias}'", \
  ENV{.HAVE_HWDB_PROPERTIES}="1"

# Device matching the input device name and the machine's DMI data
KERNELS=="input*", \
  IMPORT{builtin}="hwdb 'gmobile:name:$attr{name}:$attr{[dmi/id]modalias}'", \
  ENV{.HAVE_HWDB_PROPERTIES}="1"

# Device matching the input device name and the machine's device tree compatible
KERNELS=="input*", \
  IMPORT{builtin}="hwdb 'gmobile:name:$attr{name}:dt:$attr{[devicetree/base]compatible}'", \
  ENV{.HAVE_HWDB_PROPERTIES}="1"

LABEL="gmobile_end"
07070100000012000041ED0000000000000000000000026857C08300000000000000000000000000000000000000000000001B00000000gmobile-0.4.0/data/devices07070100000013000041ED0000000000000000000000026857C08300000000000000000000000000000000000000000000002A00000000gmobile-0.4.0/data/devices/display-panels07070100000014000081A40000000000000000000000016857C0830000021B000000000000000000000000000000000000003D00000000gmobile-0.4.0/data/devices/display-panels/daria,zahedan.json{
    "name": "Daria Bond",
    "x-res": 1080,
    "y-res": 2400,
    "border-radius": 60,
    "cutouts": [
        {
            "name": "notch",
            "path": "M 551.463,21.058 C 544.368,16.981 535.601,16.981 528.507,21.058 L 516.457,28.03 C 509.363,32.108 505,39.692 505,47.857 L 505,61.759 C 505,69.955 509.363,77.508 516.457,81.616 L 528.538,88.578 C 535.643,92.666 544.399,92.666 551.494,88.578 L 563.543,81.616 C 570.638,77.529 575,69.955 575,61.759 L 575,47.857 C 575,39.692 570.638,32.108 563.543,28.03 Z"
        }
    ]
}
07070100000015000081A40000000000000000000000016857C083000000FC000000000000000000000000000000000000003D00000000gmobile-0.4.0/data/devices/display-panels/fairphone,fp4.json{
  "name": "Fairphone 4",
  "x-res": 1080,
  "y-res": 2340,
  "border-radius": 100,
  "width": 67,
  "height": 145,
  "cutouts" : [
    {
      "name": "notch",
      "path": "M 355,0  H 725 C 580,0 615,82 540,82  C 465,82 500,0 355,0  Z"
    }
  ]
}
07070100000016000081A40000000000000000000000016857C083000000F3000000000000000000000000000000000000003D00000000gmobile-0.4.0/data/devices/display-panels/fairphone,fp5.json{
  "name": "Fairphone 5",
  "x-res": 1224,
  "y-res": 2700,
  "border-radius": 100,
  "width": 68,
  "height": 150,
  "cutouts" : [
    {
      "name": "notch",
      "path": "M 612 16  a 42 42 0 0 0 0 84  a 42 42 0 0 0 0 -84  Z"
    }
  ]
}
07070100000017000081A40000000000000000000000016857C083000000F6000000000000000000000000000000000000003D00000000gmobile-0.4.0/data/devices/display-panels/furilabs,flx1.json{
  "name": "FuriLabs FLX1",
  "x-res": 1080,
  "y-res": 2412,
  "border-radius": 100,
  "width": 68,
  "height": 157,
  "cutouts" : [
    {
      "name": "camera",
      "path": "M 103 27  a 42 42 0 0 0 0 84  a 42 42 0 0 0 0 -84  Z"
    }
  ]
}
07070100000018000081A40000000000000000000000016857C08300000445000000000000000000000000000000000000003B00000000gmobile-0.4.0/data/devices/display-panels/gigaset,gs5.json{
    "name": "Gigaset GS5",
    "x-res": 1080,
    "y-res": 2340,
    "cutouts": [
        {
            "name": "notch",
            "path": "M 687.138,0.774 L 677.5,1.76 L 667.866,3.352 L 665.46,3.861 L 663.346,4.35 L 659.414,5.363 L 651.625,7.793 L 644.008,10.765 L 636.654,14.282 L 629.654,18.349 L 626.314,20.589 L 624.577,21.845 L 622.653,23.312 L 615.36,29.623 L 608.585,36.503 L 602.163,43.767 L 589.717,58.714 L 584.79,63.96 L 579.384,68.591 L 573.554,72.581 L 567.354,75.904 L 560.844,78.534 L 554.078,80.445 L 547.111,81.611 C 547.111,81.611 540.436,82.006 539.999,82.006 C 539.562,82.006 532.887,81.611 532.887,81.611 L 525.92,80.445 L 519.154,78.534 L 512.644,75.904 L 506.444,72.581 L 500.614,68.591 L 495.208,63.96 L 490.281,58.714 L 477.839,43.767 L 471.416,36.5 L 464.641,29.621 L 457.349,23.31 L 455.426,21.843 L 453.688,20.587 L 450.348,18.347 L 443.348,14.28 L 435.994,10.763 L 428.377,7.793 L 420.588,5.363 L 416.657,4.349 L 414.543,3.86 L 412.137,3.351 L 402.5,1.76 L 392.863,0.773 L 383.25,0.248 L 364,8.43769E-15 L 716,8.43769E-15 L 696.753,0.248 Z"
        }
    ]
}
07070100000019000081A40000000000000000000000016857C0830000017E000000000000000000000000000000000000003B00000000gmobile-0.4.0/data/devices/display-panels/gigaset,gx4.json{
    "name": "Gigaset GX4",
    "x-res": 720,
    "y-res": 1560,
    "cutouts": [
        {
            "name": "notch",
            "path": "M 422,-0.034 C 414.459,-0.034 406.115,5.85618 400.26,23.3557 C 394.727,39.8872 379.679,51.23 360.87,51.23 C 342.06,51.23 325.262,39.8822 319.728,23.3557 C 313.868,5.85618 305.545,-0.034 286.996,-0.125 L 432.996,-0.125 Z"
        }
    ]
}
0707010000001A000081A40000000000000000000000016857C083000000F2000000000000000000000000000000000000003B00000000gmobile-0.4.0/data/devices/display-panels/moto,bronco.json{
    "name": "Motorola ThinkPhone",
    "x-res": 1080,
    "y-res": 2400,
    "border-radius": 75,
    "cutouts": [
        {
            "name": "notch",
            "path": "M 504,0 L 504,102 L 576,102 L 576,0 L 540,0 Z"
        }
    ]
}
0707010000001B000081A40000000000000000000000016857C083000000D9000000000000000000000000000000000000004000000000gmobile-0.4.0/data/devices/display-panels/nothing,spacewar.json{
  "name": "Nothing Phone (1)",
  "border-radius": 107,
  "width": 76,
  "height": 159,
  "x-res": 1080,
  "y-res": 2400,
  "cutouts" : [
    {
      "name": "camera",
      "path": "M 83,35 h 65 v 65 Z"
    }
  ]
}
0707010000001C000081A40000000000000000000000016857C0830000016B000000000000000000000000000000000000004100000000gmobile-0.4.0/data/devices/display-panels/oneplus,enchilada.json{
  "name": "Oneplus 6",
  "x-res": 1080,
  "y-res": 2280,
  "border-radius": 80,
  "comment": "In future for gmobile#5, bottom border radius is 66",
  "width": 68,
  "height": 145,
  "cutouts" : [
    {
      "name": "notch",
      "path": "M 357 0  A 24 24 0 0 1 381 22  A 64 64 0 0 0 445 80  L 635 80  A 64 64 0 0 0 699 22  A 24 24 0 0 1 723 0  Z"
    }
  ]
}
0707010000001D000081A40000000000000000000000016857C08300000235000000000000000000000000000000000000003E00000000gmobile-0.4.0/data/devices/display-panels/oneplus,fajita.json{
  "name": "Oneplus 6T",
  "x-res": 1080,
  "y-res": 2340,
  "border-radius": 120,
  "width": 68,
  "height": 145,
  "cutouts" : [
    {
      "name": "notch",
      "path": "M 355,0  h 368.34  c -9.77,0.44 -19.57,0.08 -29.28,1.24  c -20.33,1.14 -41.18,5.17 -58.62,16.24  c -16.9,10.79 -29.44,26.78 -43.44,40.81  a 72.73,72.73 0 0 1 -38.29 19.58  c -16.53,2.51 -34,1 -49.09,-6.62  c -9.85,-4.62 -17.88,-12.24 -25.21,-20.18  c -10.46,-11.27 -20.9,-22.75 -33.53,-31.66  c -11.49,-8 -24.9,-12.78 -38.53,-15.42  c -17.27,-3.18 -34.86,-3.6 -52.35,-3.99  Z"
    }
  ]
}
0707010000001E000081A40000000000000000000000016857C08300000206000000000000000000000000000000000000003C00000000gmobile-0.4.0/data/devices/display-panels/pixel,oriole.json{
    "name": "Google Pixel 6",
    "x-res": 1080,
    "y-res": 2400,
    "cutouts": [
        {
            "name": "notch",
            "path": "M 551.463,21.058 C 544.368,16.981 535.601,16.981 528.507,21.058 L 516.457,28.03 C 509.363,32.108 505,39.692 505,47.857 L 505,61.759 C 505,69.955 509.363,77.508 516.457,81.616 L 528.538,88.578 C 535.643,92.666 544.399,92.666 551.494,88.578 L 563.543,81.616 C 570.638,77.529 575,69.955 575,61.759 L 575,47.857 C 575,39.692 570.638,32.108 563.543,28.03 Z"
        }
    ]
}
0707010000001F000081A40000000000000000000000016857C0830000020A000000000000000000000000000000000000003B00000000gmobile-0.4.0/data/devices/display-panels/pixel,raven.json{
    "name": "Google Pixel 6 Pro",
    "x-res": 1080,
    "y-res": 2400,
    "cutouts": [
        {
            "name": "notch",
            "path": "M 551.463,21.058 C 544.368,16.981 535.601,16.981 528.507,21.058 L 516.457,28.03 C 509.363,32.108 505,39.692 505,47.857 L 505,61.759 C 505,69.955 509.363,77.508 516.457,81.616 L 528.538,88.578 C 535.643,92.666 544.399,92.666 551.494,88.578 L 563.543,81.616 C 570.638,77.529 575,69.955 575,61.759 L 575,47.857 C 575,39.692 570.638,32.108 563.543,28.03 Z"
        }
    ]
}
07070100000020000081A40000000000000000000000016857C08300000061000000000000000000000000000000000000003E00000000gmobile-0.4.0/data/devices/display-panels/purism,librem5.json{
  "name": "Purism Librem 5",
  "x-res": 720,
  "y-res": 1440,
  "width": 65,
  "height": 130
}
07070100000021000081A40000000000000000000000016857C08300000448000000000000000000000000000000000000003E00000000gmobile-0.4.0/data/devices/display-panels/volla,mimameid.json{
    "name": "Volla Phone 22",
    "x-res": 1080,
    "y-res": 2340,
    "cutouts": [
        {
            "name": "notch",
            "path": "M 687.138,0.774 L 677.5,1.76 L 667.866,3.352 L 665.46,3.861 L 663.346,4.35 L 659.414,5.363 L 651.625,7.793 L 644.008,10.765 L 636.654,14.282 L 629.654,18.349 L 626.314,20.589 L 624.577,21.845 L 622.653,23.312 L 615.36,29.623 L 608.585,36.503 L 602.163,43.767 L 589.717,58.714 L 584.79,63.96 L 579.384,68.591 L 573.554,72.581 L 567.354,75.904 L 560.844,78.534 L 554.078,80.445 L 547.111,81.611 C 547.111,81.611 540.436,82.006 539.999,82.006 C 539.562,82.006 532.887,81.611 532.887,81.611 L 525.92,80.445 L 519.154,78.534 L 512.644,75.904 L 506.444,72.581 L 500.614,68.591 L 495.208,63.96 L 490.281,58.714 L 477.839,43.767 L 471.416,36.5 L 464.641,29.621 L 457.349,23.31 L 455.426,21.843 L 453.688,20.587 L 450.348,18.347 L 443.348,14.28 L 435.994,10.763 L 428.377,7.793 L 420.588,5.363 L 416.657,4.349 L 414.543,3.86 L 412.137,3.351 L 402.5,1.76 L 392.863,0.773 L 383.25,0.248 L 364,8.43769E-15 L 716,8.43769E-15 L 696.753,0.248 Z"
        }
    ]
}
07070100000022000081A40000000000000000000000016857C08300000182000000000000000000000000000000000000003E00000000gmobile-0.4.0/data/devices/display-panels/volla,vidofnir.json{
    "name": "Volla Phone X23",
    "x-res": 720,
    "y-res": 1560,
    "cutouts": [
        {
            "name": "notch",
            "path": "M 422,-0.034 C 414.459,-0.034 406.115,5.85618 400.26,23.3557 C 394.727,39.8872 379.679,51.23 360.87,51.23 C 342.06,51.23 325.262,39.8822 319.728,23.3557 C 313.868,5.85618 305.545,-0.034 286.996,-0.125 L 432.996,-0.125 Z"
        }
    ]
}
07070100000023000081A40000000000000000000000016857C0830000025F000000000000000000000000000000000000003F00000000gmobile-0.4.0/data/devices/display-panels/xiaomi,angelica.json{
    "name": "Xiaomi Redmi 9C",
    "x-res": 720,
    "y-res": 1600,
    "border-radius": 70,
    "cutouts": [
        {
            "name": "notch",
            "path": "M 301,12.8899 C 308.659,20.2116 314.174,25.5003 317.545,29.3876 C 322.594,35.211 327.448,41.2298 333.624,45.6443 C 337.489,48.402 341.87,50.536 346.449,51.9524 C 350.841,53.3087 355.421,55 360,55 C 364.576,55 369.148,53.3087 373.539,51.9524 C 378.126,50.536 382.507,48.402 386.365,45.6443 C 392.552,41.2298 397.406,35.211 402.455,29.3876 C 405.824,25.5003 411.339,20.2116 419,13.5216 L 419,0 L 301,0 L 301,13.5216 Z"
        }
    ]
}
07070100000024000081A40000000000000000000000016857C08300000263000000000000000000000000000000000000004000000000gmobile-0.4.0/data/devices/display-panels/xiaomi,angelican.json{
    "name": "Xiaomi Redmi 9C NFC",
    "x-res": 720,
    "y-res": 1600,
    "border-radius": 70,
    "cutouts": [
        {
            "name": "notch",
            "path": "M 301,12.8899 C 308.659,20.2116 314.174,25.5003 317.545,29.3876 C 322.594,35.211 327.448,41.2298 333.624,45.6443 C 337.489,48.402 341.87,50.536 346.449,51.9524 C 350.841,53.3087 355.421,55 360,55 C 364.576,55 369.148,53.3087 373.539,51.9524 C 378.126,50.536 382.507,48.402 386.365,45.6443 C 392.552,41.2298 397.406,35.211 402.455,29.3876 C 405.824,25.5003 411.339,20.2116 419,13.5216 L 419,0 L 301,0 L 301,13.5216 Z"
        }
    ]
}
07070100000025000081A40000000000000000000000016857C0830000019B000000000000000000000000000000000000004000000000gmobile-0.4.0/data/devices/display-panels/xiaomi,beryllium.json{
    "name": "Xiaomi POCO F1",
    "x-res": 1080,
    "y-res": 2246,
    "border-radius": 104,
    "width": 68,
    "height": 145,
    "cutouts" : [
      {
        "name": "notch",
        "path": "M 834,0  c -10.516,0 -19.04,8.557 -19.04,19.11  c 0,40.084 -26.988,69.89 -60.283,69.89  l -428.354,0  c -33.295,0 -60.283,-29.806 -60.283,-63.227  c 0,-17.216 -8.524,-25.773 -19.04,-25.773  Z"
      }
    ]
  }
07070100000026000081A40000000000000000000000016857C083000000F3000000000000000000000000000000000000003E00000000gmobile-0.4.0/data/devices/display-panels/xiaomi,curtana.json{
    "name": "Xiaomi Redmi Note 9S",
    "x-res": 1080,
    "y-res": 2400,
    "border-radius": 93,
    "cutouts": [
        {
            "name": "notch",
            "path": "M 504,0 L 504,102 L 576,102 L 576,0 L 540,0 Z"
        }
    ]
}
07070100000027000081A40000000000000000000000016857C083000000CA000000000000000000000000000000000000003C00000000gmobile-0.4.0/data/devices/display-panels/xiaomi,daisy.json{
  "name": "Xiaomi Mi A2 Lite",
  "x-res": 1080,
  "y-res": 2280,
  "border-radius": 120,
  "cutouts" : [
    {
      "name": "notch",
      "path": "M 334,0 L 392,100 L 688,100 L 746,0 Z"
    }
  ]
}
07070100000028000081A40000000000000000000000016857C0830000025F000000000000000000000000000000000000004000000000gmobile-0.4.0/data/devices/display-panels/xiaomi,dandelion.json{
    "name": "Xiaomi Redmi 9A",
    "x-res": 720,
    "y-res": 1600,
    "border-radius": 70,
    "cutouts": [
        {
            "name": "notch",
            "path": "M 301,12.8899 C 308.659,20.2116 314.174,25.5003 317.545,29.3876 C 322.594,35.211 327.448,41.2298 333.624,45.6443 C 337.489,48.402 341.87,50.536 346.449,51.9524 C 350.841,53.3087 355.421,55 360,55 C 364.576,55 369.148,53.3087 373.539,51.9524 C 378.126,50.536 382.507,48.402 386.365,45.6443 C 392.552,41.2298 397.406,35.211 402.455,29.3876 C 405.824,25.5003 411.339,20.2116 419,13.5216 L 419,0 L 301,0 L 301,13.5216 Z"
        }
    ]
}
07070100000029000081A40000000000000000000000016857C083000000FA000000000000000000000000000000000000004000000000gmobile-0.4.0/data/devices/display-panels/xiaomi,excalibur.json{
    "name": "Xiaomi Redmi Note 9 Pro Max",
    "x-res": 1080,
    "y-res": 2400,
    "border-radius": 93,
    "cutouts": [
        {
            "name": "notch",
            "path": "M 504,0 L 504,102 L 576,102 L 576,0 L 540,0 Z"
        }
    ]
}
0707010000002A000081A40000000000000000000000016857C083000000F1000000000000000000000000000000000000003B00000000gmobile-0.4.0/data/devices/display-panels/xiaomi,gram.json{
    "name": "Xiaomi POCO M2 Pro",
    "x-res": 1080,
    "y-res": 2400,
    "border-radius": 93,
    "cutouts": [
        {
            "name": "notch",
            "path": "M 504,0 L 504,102 L 576,102 L 576,0 L 540,0 Z"
        }
    ]
}
0707010000002B000081A40000000000000000000000016857C083000000F6000000000000000000000000000000000000003E00000000gmobile-0.4.0/data/devices/display-panels/xiaomi,joyeuse.json{
    "name": "Xiaomi Redmi Note 9 Pro",
    "x-res": 1080,
    "y-res": 2400,
    "border-radius": 93,
    "cutouts": [
        {
            "name": "notch",
            "path": "M 504,0 L 504,102 L 576,102 L 576,0 L 540,0 Z"
        }
    ]
}
0707010000002C000081A40000000000000000000000016857C08300000170000000000000000000000000000000000000003F00000000gmobile-0.4.0/data/devices/display-panels/xiaomi,lavender.json{
    "name": "Xiaomi Redmi Note 7",
    "x-res": 1080,
    "y-res": 2340,
    "border-radius": 106,
    "cutouts": [
        {
            "name": "notch",
            "path": "M 482,0 L 482,45.4058 C 504.556,67.8222 523.889,79.0202 540,79 C 543.825,78.9952 547.71,78.6729 551.606,77.986 C 564.883,75.6441 580.346,64.7753 597.997,45.3795 L 598,0 Z"
        }
    ]
}
0707010000002D000081A40000000000000000000000016857C0830000039A000000000000000000000000000000000000003E00000000gmobile-0.4.0/data/devices/display-panels/xiaomi,onclite.json{
    "name": "Xiaomi Redmi 7",
    "x-res": 720,
    "y-res": 1520,
    "border-radius": 68,
    "cutouts": [
        {
            "name": "notch",
            "path": "M 360.775,55 C 336.775,55 317.104,36.8654 313.902,13.8399 C 313.813,13.1787 313.716,12.5213 313.626,11.8639 C 313.421,10.8067 313.212,9.74958 313.007,8.69245 C 312.828,8.16948 312.641,7.65025 312.458,7.13102 C 312.029,6.39139 311.604,5.64804 311.174,4.90468 C 310.577,4.25844 309.988,3.6122 309.394,2.96597 C 309.307,2.90496 309.175,2.81357 308.999,2.69179 L 309.001,0 L 411.001,0 L 411,2.694 C 410.826,2.8148 410.695,2.90546 410.608,2.96597 C 410.014,3.6122 409.425,4.25844 408.828,4.90468 C 408.398,5.64804 407.973,6.39139 407.544,7.13102 C 407.361,7.65025 407.174,8.16948 406.992,8.69245 C 406.79,9.74958 406.581,10.8067 406.376,11.8639 C 406.286,12.5213 406.193,13.1787 406.103,13.8399 C 402.898,36.8654 383.227,55 359.999,55 Z"
        }
    ]
}
0707010000002E000081A40000000000000000000000016857C083000009DB000000000000000000000000000000000000002A00000000gmobile-0.4.0/data/gmobile.gresources.xml<?xml version="1.0" encoding="UTF-8"?>
<gresources>
  <gresource prefix="/org/gnome/gmobile/">
    <!-- Devices with one panel matched by their DT compatible -->
    <file preprocess="json-stripblanks">devices/display-panels/daria,zahedan.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/fairphone,fp4.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/fairphone,fp5.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/furilabs,flx1.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/gigaset,gs5.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/gigaset,gx4.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/moto,bronco.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/nothing,spacewar.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/pixel,oriole.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/pixel,raven.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/oneplus,enchilada.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/oneplus,fajita.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/purism,librem5.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/volla,mimameid.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/volla,vidofnir.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/xiaomi,angelica.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/xiaomi,angelican.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/xiaomi,beryllium.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/xiaomi,curtana.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/xiaomi,daisy.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/xiaomi,dandelion.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/xiaomi,excalibur.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/xiaomi,gram.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/xiaomi,joyeuse.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/xiaomi,onclite.json</file>
    <file preprocess="json-stripblanks">devices/display-panels/xiaomi,lavender.json</file>
  </gresource>
</gresources>
0707010000002F000081A40000000000000000000000016857C08300000137000000000000000000000000000000000000001F00000000gmobile-0.4.0/data/meson.buildgm_resources = gnome.compile_resources(
  'gm-resources',
  'gmobile.gresources.xml',
  extra_args: '--manual-register',
  c_name: 'gm',
)

if get_option('hwdb')
  install_data('61-gmobile-wakeup.hwdb', install_dir: udevdir / 'hwdb.d')
  install_data('61-gmobile.rules', install_dir: udevdir / 'rules.d')
endif
07070100000030000041ED0000000000000000000000026857C08300000000000000000000000000000000000000000000001500000000gmobile-0.4.0/debian07070100000031000081A40000000000000000000000016857C0830000043E000000000000000000000000000000000000002300000000gmobile-0.4.0/debian/README.sourceThis package is maintained with git-buildpackage(1). It follows DEP-14
for branch naming (e.g. using debian/sid for the current version
in Debian unstable).

It uses pristine-tar(1) to store enough information in git to generate
bit identical tarballs when building the package without having
downloaded an upstream tarball first.

When working with patches it is recommended to use "gbp pq import" to
import the patches, modify the source and then use "gbp pq export
--commit" to commit the modifications.

The changelog is generated using "gbp dch" so if you submit any
changes don't bother to add changelog entries but rather provide
a nice git commit message that can then end up in the changelog.

It is recommended to build the package with pbuilder using:

    gbp buildpackage --git-pbuilder

For information on how to set up a pbuilder environment see the
git-pbuilder(1) manpage. In short:

    DIST=sid git-pbuilder create
    gbp clone <project-url>
    cd <project>
    gbp buildpackage --git-pbuilder

 -- Guido Günther <agx@sigxcpu.org>, Wed,  2 Dec 2015 18:51:15 +0100
07070100000032000081A40000000000000000000000016857C08300001F87000000000000000000000000000000000000001F00000000gmobile-0.4.0/debian/changeloggmobile (0.4.0) experimental; urgency=medium

  [ Guido Günther ]
  * tests: Fix name of not-installed test
  * build: Start 0.4.0 cycle
  * tests: Sort alphabetically
  * gm-mcc-mnc: Add MCC to ISO country code conversion.
    We use this in Chatty, Calls and Cbd so it should move to a library.
  * doc: Fix manpage subject.

  [ Evangelos Ribeiro Tzaras ]
  * data/hwdb: Insert empty line to indicate a new input device.
    Fixes b1cd28b89a105b83b3b485c28f94af0b53dc6966
  * data/hwdb: Add Fairphone 5
  * meson: Fix typo

  [ fossdd ]
  * data: Add border radius for oneplus,enchilada

  [ Bardia Moshiri ]
  * data/hwdb: Add FuriPhone FLX1

 -- Guido Günther <agx@sigxcpu.org>  Sat, 21 Jun 2025 10:59:16 +0200

gmobile (0.3.0) experimental; urgency=medium

  [ Guido Günther ]
  * ci: Update shared scripts and dotfiles to a9fef9a
  * build: Format meson files.
  * ci: Check meson format
  * build: Build vapi too
  * treewide: Drop glib version conditionals. We require glib 2.78 anyway
  * timeout: Conditionally cleanup source members.
    We might have partially inited sources when setting up a source fails.
    This can happen with the following changes.
  * timeout: Pass clockid. This allows us to use the code for different
    clock types
  * timeout: Add wakeup timer
  * timeout: Bubble up errors. This slightly changes the existing API/ABI as
    gm_timeout_add_seconds_once can now return 0 but given the current users
    that is likely o.k.
  * example: Add wake system example
  * build: Allow to install tests
  * packaging: Add package for tests
  * packaging: Add autopkgtest that runs the installed tests

  [ Adam ]
  * data/hwdb: Add pinephone 3.5mm headset play-pause button

 -- Guido Günther <agx@sigxcpu.org>  Wed, 07 May 2025 09:30:39 +0200

gmobile (0.2.2) experimental; urgency=medium

  [ Guido Günther ]
  * packaging: Don't set gtk_doc twice
  * doc: Link to wakeup key post.
    It has additional details to the manpage
  * data: Add display-panel for Furilabs FLX1.
    This information was built from scratch to be able to actually match the
    camera cutout and run unmodified gmobile / phosh.
  * build: Bump glib dependency.
    We want to use g_strv_builder_take()
  * util: Add helper to list all known devices.
    This makes it easier to e.g. show them in lists
  * data/hwdb: Add Google Pixel 3a (Sargo)
    Closes: https://gitlab.gnome.org/World/Phosh/gmobile/-/issues/12
    Thanks to Giovanni Caligaris

  [ Rafael Fontenelle ]
  * Add GPL-3-or-later to README.md

  [ Sam Day ]
  * data/hwdb: Add Samsung Galaxy A5 wakeup keys

  [ Eugene Lepshy ]
  * data: Add display information for nothing,spacewar

  [ Evangelos Ribeiro Tzaras ]
  * data/hwdb: Add xioami-daisy
  * data/hwdb: Add shift6mq wakeup keys

 -- Guido Günther <agx@sigxcpu.org>  Fri, 21 Mar 2025 18:43:07 +0100

gmobile (0.2.1) experimental; urgency=medium

  [ Guido Günther ]
  * Revert "ci: Add workaround for broken gcovr in Debian"
    This reverts commit 40a273a03c5c72b9e9790b459acf31f285291bb6.
    Debian testing has a fixed gcovr (7.2+really-1.1) again.
  * examples/run-phosh: Use scale calculation from phoc.
    Since we don't have physical dimensions for the nested display one had
    to pass in the scale to use manually. Use the data from gmobile when
    available.
  * data: Add wakeup key info for OnePlus 6/6T
  * ci: Use fdo mirror in GNOME infra. This avoids an external dependency
  * data/hwdb: Simplify entries for volume button only controllers.
    On the PP{,P} and OnePlus {Enchilada,Fajita} the volume keys are the
    only buttons on the respective controllers so we can use
    GM_WAKEUP_KEY_DEFAULT instead of listing individual keys.
  * data/hwdb: Add Juno tablets.
    Closes: https://gitlab.gnome.org/World/Phosh/gmobile/-/issues/7
    Thanks to Giovanni Caligaris
  * data/hwdb: Add generic AVRCP bluetooth hardware.
    This ensures external BT devies using this profile don't trigger unblank
    by default.
    Note that udev translates the `(AVRCP)` to `_AVRCP_`.
    Thanks to Philip Hands <phil@hands.com> for debugging this with me

  [ Arnaud Ferraris ]
  * data/hwdb: Add wakeup key info for  PinePhone Pro
  * data/hwdb: Fix PinePhone compatible string.
    The compatible string used for the original PinePhone is wrong and too
    restrictive:
    * the main string ends with the HW revision, the final `pine64` is the
      start of another compatible string
    * there are more revisions in the wild than only `1.2`, we should
      account for those as well

 -- Guido Günther <agx@sigxcpu.org>  Fri, 21 Jun 2024 22:01:52 +0200

gmobile (0.2.0) experimental; urgency=medium

  [ Guido Günther ]
  * util: Fix copyright header.
    Fixes: e8d3fa8 ("treewide: Use consistent copyright headers")
  * packaging: Update package descriptions
  * README: Mention that we can be used as a shared lib
  * build-howto: Explain how to use as a shared library
  * build: Don't use str for boolean argument. This is deprecated in meson
  * ci: No need to remove lcov anymore
  * ci: Use build dependencies. Instead of open coding these use what we have
    in packaging
  * ci: Add workaround for broken gcovr in Debian.
    See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1070172
  * ci: Add style checks
  * packaging: Handle nocheck
  * packaging: Handle nodoc
  * packaging: Ignore package dirs
  * build: Prefer '/' over join_paths()
  * data: Introduce udev rules and hwdb to track wakeup keys.
    On phones and tablets the only key that should usually unidle a device
    is the power button while other exposed hardware keys like the volume
    buttons shouldn't e.g. take the device out of idle / unblank the screen.
    Allow to specify whether an input device has wakeup keys (default is
    1) and to specify whether individual keys on that device are wakeup
    keys or not. E.g.
    gmobile:…
     GM_WAKEUP_KEY_DEFAULT=0
     GM_WAKEUP_KEY_116=1
    would mark all keys on the matching input device as non-wakeup keys
    with the exception of the power button. This would be a typical setting
    for phones. Whereas on a convertible that has a single keyboard device
    containing both the exposed volume keys as well as the regular input
    keys
    gmobile:…
     GM_WAKEUP_KEY_114=0
     GM_WAKEUP_KEY_115=0
    would allow all keys to unidle the device except for the exposed volume
    rocker.
    See https://github.com/systemd/systemd/pull/32261 for details
    Device tree devices can't match via dmi modalias. The corresponding
    thing there is the DT compatible. Allow to match by the most specific
    part of the device tree compatible. This allows to e.g. match the volume
    keys on a Librem 5 like:
      gmobile:name:gpio-keys:dt:purism,librem5*
    matching on a specific model would look like
      gmobile:name:gpio-keys:dt:purism,librem5r4
    See https://github.com/systemd/systemd/pull/32362 for details
  * data/hwdb: Add wakeup keys for the Librem 11 tablet
  * data/hwdb: Add wakeup keys for the Librem 5 phone
  * doc: Add manpage explaining the hwdb entries.
    This text based on parts of the libinput documentation.

  [ nee ]
  * data/hwdb: Add wakeup keys for the PinePhone beta
    based on outputs with postmarket-os edge gnome-mobile:
    pine64-pinephone:~$ sudo libinput debug-events
    -event4   KEYBOARD_KEY            +4294967.294s KEY_VOLUMEUP (115) pressed
     event4   KEYBOARD_KEY            +0.193s       KEY_VOLUMEUP (115) released
     event4   KEYBOARD_KEY            +1.586s       KEY_VOLUMEDOWN (114) pressed
     event4   KEYBOARD_KEY            +1.817s       KEY_VOLUMEDOWN (114) released
    pine64-pinephone:~$ cat /sys/class/input/event4/device/name
    1c21800.lradc
    pine64-pinephone:~$ cat /sys/firmware/devicetree/base/compatible
    pine64,pinephone-1.2pine64,pinephoneallwinner,sun50i-a64

 -- Guido Günther <agx@sigxcpu.org>  Fri, 10 May 2024 11:45:37 +0200

gmobile (0.1.0) experimental; urgency=medium

  * Initial release

 -- Guido Günther <agx@sigxcpu.org>  Fri, 08 Mar 2024 17:57:06 +0100
07070100000033000081A40000000000000000000000016857C08300000AD5000000000000000000000000000000000000001D00000000gmobile-0.4.0/debian/controlSource: gmobile
Priority: optional
Maintainer: Guido Günther <agx@sigxcpu.org>
Build-Depends:
 debhelper-compat (= 13),
 gi-docgen <!nodoc>,
 libgirepository1.0-dev,
 libglib2.0-dev,
 libjson-glib-dev,
 meson,
 valac,
 pkgconf,
 python3-docutils <!nodoc>,
Standards-Version: 4.6.2
Section: libs
Homepage: https://gitlab.gnome.org/World/Phosh/gmobile/
Rules-Requires-Root: no

Package: libgmobile-dev
Section: libdevel
Architecture: any
Multi-Arch: same
Depends:
 ${misc:Depends},
 gir1.2-gm-0 (= ${binary:Version}),
 libgmobile0 (= ${binary:Version}),
 libglib2.0-dev,
 libjson-glib-dev,
Description: Mobile related helpers - development headers
 gmobile is a library containing mobile related helpers for
 glib based projects.
 .
 This package contains the development headers.

Package: libgmobile0
Architecture: any
Multi-Arch: same
Depends:
 ${misc:Depends},
 ${shlibs:Depends},
 libgmobile-common (>= ${source:Version}),
Description: Mobile related helpers - shared library
 gmobile is a library containing mobile related helpers for
 glib based projects.
 .
 This package contains the shared library.

Package: libgmobile-common
Section: misc
Architecture: all
Multi-Arch: foreign
Depends: ${misc:Depends}
Recommends: libgmobile0
Description: common files for the gmobile library
 gmobile is a library containing mobile related helpers for
 glib based projects.
 .
 This package contains common files like the hwdb and udev rules.

Package: libgmobile-examples
Architecture: any
Depends:
 ${misc:Depends},
 ${shlibs:Depends},
Description: Mobile related helpers - binaries
 gmobile is a library containing mobile related helpers for
 glib based projects.
 .
 This package contains examples on how to use gmobile.

Package: gir1.2-gm-0
Architecture: any
Multi-Arch: same
Section: introspection
Depends:
 ${gir:Depends},
 ${misc:Depends},
 ${shlibs:Depends},
Description: GObject introspection data for gmobile
 gmobile is a library containing mobile related helpers for
 glib based projects.
 .
 This package contains introspection data for the gmoible library.

Package: libgmobile-doc
Section: doc
Architecture: all
Multi-Arch: foreign
Depends: ${misc:Depends}
Recommends: libglib2.0-doc,
Suggests: devhelp
Description: documentation for the gmobile library
 gmobile is a library containing mobile related helpers for
 glib based projects.
 .
 This package contains the HTML documentation for the gmobile library.

Package: gmobile-tests
Build-Profiles: <!noinsttest>
Section: misc
Architecture: any
Depends:
 ${misc:Depends},
 ${shlibs:Depends},
Description: "as-installed" tests for gmobile
 gmobile is a library containing mobile related helpers for
 glib based projects.
 .
 This package contains installable test programs, primarily for use with
 autopkgtest.
07070100000034000081A40000000000000000000000016857C083000007A3000000000000000000000000000000000000001F00000000gmobile-0.4.0/debian/copyrightFormat: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: https://gitlab.gnome.org/World/Phosh/gmobile

Files: *
Copyright: 2022-2024 The Phosh Developers
           2022 Purism SPC
License: LGPL-2.1+

Files: examples/*
       tests/*
       debian/*
Copyright: 2022-2023 The Phosh Developers
           2022 Purism SPC
License: GPL-3+

License: GPL-3+
 This package is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 3 of the License, or
 (at your option) any later version.
 .
 This package is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 .
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <https://www.gnu.org/licenses/>
 .
 On Debian systems, the complete text of the GNU General
 Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".

License: LGPL-2.1+
 This package is free software; you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as published by
 the Free Software Foundation; either version 3 of the License, or
 (at your option) any later version.
 .
 This package is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU Lesser General Public License for more details.
 .
 You should have received a copy of the GNU Lesser General Public License
 along with this program. If not, see <https://www.gnu.org/licenses/>
 .
 On Debian systems, the complete text of the GNU Lesser General
 Public License version 3 can be found in "/usr/share/common-licenses/LGPL-2.1".
07070100000035000081A40000000000000000000000016857C0830000010B000000000000000000000000000000000000001E00000000gmobile-0.4.0/debian/gbp.conf[DEFAULT]
debian-branch = main
debian-tag = v%(version)s
debian-tag-msg = %(pkg)s v%(version)s

[tag]
sign-tags = true

[dch]
postedit = sed -i s"@^\( \+version: '\)[0-9.]\+\(',\)@\1$GBP_DEBIAN_VERSION\2@" meson.build
ignore-regex = ((Signed-off|Acked)-by:|Part-of:)
07070100000036000081A40000000000000000000000016857C08300000028000000000000000000000000000000000000002900000000gmobile-0.4.0/debian/gir1.2-gm-0.installusr/lib/*/girepository-1.0/Gm-0.typelib
07070100000037000081A40000000000000000000000016857C08300000048000000000000000000000000000000000000002B00000000gmobile-0.4.0/debian/gmobile-tests.installusr/libexec/installed-tests/gmobile/
usr/share/installed-tests/gmobile/
07070100000038000081A40000000000000000000000016857C0830000000F000000000000000000000000000000000000002F00000000gmobile-0.4.0/debian/libgmobile-common.install/usr/lib/udev/
07070100000039000081A40000000000000000000000016857C08300000022000000000000000000000000000000000000003000000000gmobile-0.4.0/debian/libgmobile-common.manpagesusr/share/man/man5/gmobile.udev.5
0707010000003A000081A40000000000000000000000016857C08300000092000000000000000000000000000000000000002C00000000gmobile-0.4.0/debian/libgmobile-dev.installusr/include/gmobile/
usr/lib/*/libgmobile.a
usr/lib/*/libgmobile.so
usr/lib/*/pkgconfig/gmobile.pc
usr/share/gir-1.0/Gm-0.gir
usr/share/vala/vapi
0707010000003B000081A40000000000000000000000016857C08300000019000000000000000000000000000000000000002900000000gmobile-0.4.0/debian/libgmobile-doc.docsusr/share/doc/gmobile-0/
0707010000003C000081A40000000000000000000000016857C08300000048000000000000000000000000000000000000002A00000000gmobile-0.4.0/debian/libgmobile-doc.linksusr/share/doc/libgmobile-dev/gmobile-0 usr/share/gtk-doc/html/gmobile-0
0707010000003D000081A40000000000000000000000016857C08300000021000000000000000000000000000000000000003100000000gmobile-0.4.0/debian/libgmobile-examples.installusr/bin/gm-display-panel-preview
0707010000003E000081A40000000000000000000000016857C0830000001A000000000000000000000000000000000000002900000000gmobile-0.4.0/debian/libgmobile0.installusr/lib/*/libgmobile.so.*
0707010000003F000081A40000000000000000000000016857C08300000024000000000000000000000000000000000000002800000000gmobile-0.4.0/debian/libgmobile0.shlibslibgmobile 0 libgmobile0 (>= 0.1.0)
07070100000040000081A40000000000000000000000016857C083000003DF000000000000000000000000000000000000002900000000gmobile-0.4.0/debian/libgmobile0.symbolslibgmobile.so.0 libgmobile0 #MINVER#
 gm_cutout_get_bounds@Base 0.1.0
 gm_cutout_get_name@Base 0.1.0
 gm_cutout_get_path@Base 0.1.0
 gm_cutout_get_type@Base 0.1.0
 gm_cutout_new@Base 0.1.0
 gm_device_info_get_display_panel@Base 0.1.0
 gm_device_info_get_type@Base 0.1.0
 gm_device_info_new@Base 0.1.0
 gm_device_tree_get_compatibles@Base 0.1.0
 gm_display_panel_get_border_radius@Base 0.1.0
 gm_display_panel_get_cutouts@Base 0.1.0
 gm_display_panel_get_height@Base 0.1.0
 gm_display_panel_get_name@Base 0.1.0
 gm_display_panel_get_type@Base 0.1.0
 gm_display_panel_get_width@Base 0.1.0
 gm_display_panel_get_x_res@Base 0.1.0
 gm_display_panel_get_y_res@Base 0.1.0
 gm_display_panel_new@Base 0.1.0
 gm_display_panel_new_from_data@Base 0.1.0
 gm_display_panel_new_from_resource@Base 0.1.0
 gm_error_quark@Base 0.1.0
 gm_init@Base 0.1.0
 gm_rect_get_type@Base 0.1.0
 gm_svg_path_get_bounding_box@Base 0.1.0
 gm_timeout_add_seconds_once@Base 0.1.0
 gm_timeout_add_seconds_once_full@Base 0.1.0

07070100000041000081A40000000000000000000000016857C08300000036000000000000000000000000000000000000002300000000gmobile-0.4.0/debian/not-installedusr/bin/gm-display-panel-run-phosh
usr/bin/gm-timeout
07070100000042000081ED0000000000000000000000016857C08300000223000000000000000000000000000000000000001B00000000gmobile-0.4.0/debian/rules#!/usr/bin/make -f
#export DH_VERBOSE = 1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

CONFIGURE_OPTS  = -Dexamples=true
CONFIGURE_OPTS += -Dtests=$(if $(filter nocheck,$(DEB_BUILD_PROFILES)),false,true)
CONFIGURE_OPTS += -Dgtk_doc=$(if $(filter nodoc,$(DEB_BUILD_PROFILES)),false,true)
CONFIGURE_OPTS += -Dman=$(if $(filter nodoc,$(DEB_BUILD_PROFILES)),false,true)
CONFIGURE_OPTS += -Dinstalled_tests=$(if $(filter noinsttest,$(DEB_BUILD_PROFILES)),false,true)

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- $(CONFIGURE_OPTS)
07070100000043000041ED0000000000000000000000026857C08300000000000000000000000000000000000000000000001C00000000gmobile-0.4.0/debian/source07070100000044000081A40000000000000000000000016857C0830000000D000000000000000000000000000000000000002300000000gmobile-0.4.0/debian/source/format3.0 (native)
07070100000045000041ED0000000000000000000000026857C08300000000000000000000000000000000000000000000001B00000000gmobile-0.4.0/debian/tests07070100000046000081ED0000000000000000000000016857C08300000179000000000000000000000000000000000000002600000000gmobile-0.4.0/debian/tests/build-test#!/bin/sh

set -e
set -u
set -x

CFLAGS=$(pkgconf --shared --cflags gmobile)
LIBS=$(pkgconf --libs gmobile gobject-2.0)

gcc ${CFLAGS} debian/tests/test.c ${LIBS}
./a.out
echo "Shared lib build test of $< succeeded"

LIBS=$(pkgconf --static --libs gmobile gobject-2.0)
gcc ${CFLAGS} debian/tests/test.c ${LIBS}
./a.out
echo "Static lib build test of $< succeeded"

rm -f a.out
07070100000047000081A40000000000000000000000016857C083000000CF000000000000000000000000000000000000002300000000gmobile-0.4.0/debian/tests/controlTests: build-test
Depends: libgmobile-dev, pkgconf
Restrictions: allow-stderr, superficial

Tests: installed-tests
Restrictions: allow-stderr
Depends: gmobile-tests, dbus, xauth, xvfb, gnome-desktop-testing
07070100000048000081ED0000000000000000000000016857C08300000086000000000000000000000000000000000000002B00000000gmobile-0.4.0/debian/tests/installed-tests#!/bin/sh

set -eu

export XDG_RUNTIME_DIR="${AUTOPKGTEST_TMP}"

dbus-run-session -- xvfb-run -a gnome-desktop-testing-runner gmobile
07070100000049000081A40000000000000000000000016857C0830000011F000000000000000000000000000000000000002200000000gmobile-0.4.0/debian/tests/test.c#define GMOBILE_USE_UNSTABLE_API
#include <gmobile.h>

int main()
{
  g_autoptr (GmDeviceInfo) info = NULL;

  gm_device_tree_get_compatibles (NULL, NULL);
  info = gm_device_info_new ((const char *const []){"Purism,Librem5", NULL});
  g_assert (GM_IS_DEVICE_INFO (info));
  return 0;
}
0707010000004A000041ED0000000000000000000000026857C08300000000000000000000000000000000000000000000001200000000gmobile-0.4.0/doc0707010000004B000081A40000000000000000000000016857C083000006B1000000000000000000000000000000000000002100000000gmobile-0.4.0/doc/build-howto.mdTitle: Compiling with gmobile
Slug: building

# Compiling with gmobile

If you need to build gmobile, get the source from
[here](https://gitlab.gnome.org/World/Phosh/gmobile/) and see the `README.md` file.

## Using pkg-config

Like other libraries, gmobile uses `pkg-config` to provide compiler
options. The package name is `gmobile`.


If you use Automake/Autoconf, in your `configure.ac` script, you might specify
something like:

```
PKG_CHECK_MODULES(GMOBILE, [gmobile])
AC_SUBST(GMOBILE_CFLAGS)
AC_SUBST(GMOBILE_LIBS)
```

Or when using the Meson build system you can declare a dependency like:

```meson
dependency('gmobile')
```

## Bundling the library

If you don't want to use the shared library gmobile can be bundled in
one of two ways:

### As a git submodule

To use it as a submodule add the submodule to git

```
git submodule add https://gitlab.gnome.org/World/Phosh/gmobile.git subprojects/gmobile
```

And then add this to your `meson.build`:

```meson
gmobile = subproject('gmobile',
  default_options: [
    'package_name=' + meson.project_name(),
    'package_version=' + meson.project_version(),
    'pkgdatadir=' + pkgdatadir,
    'pkglibdir=' + pkglibdir,
    'examples=false',
    'gtk_doc=false',
    'tests=false',
  ])
gmobile_dep = gmobile.get_variable('gmobile_dep')
```

### As a meson subproject

To use it as a meson subproject add this to `subprojects/gmobile.wrap`:

```ini
[wrap-git]
directory=gmobile
url=https://gitlab.gnome.org/World/Phosh/gmobile.git
revision=main
depth=1
```

You can then use `gmobile_dep` in your mesn build files like:

```meson
gmobile = dependency('gmobile',
                     fallback: ['gmobile', 'gmobile_dep'],
			         native: true)
```
0707010000004C000081A40000000000000000000000016857C0830000044D000000000000000000000000000000000000002200000000gmobile-0.4.0/doc/gmobile.toml.in[library]
version = "@VERSION@"
description = "Functions and Objects useful in mobile related, glib based projects"
authors = "The Phosh Developers"
license = "LGPL-2.1-or-later"
browse_url = "https://gitlab.gnome.org/World/Phosh/gmobile/"
repository_url = "https://gitlab.gnome.org/World/Phosh/gmobile.git"
website_url = "https://gitlab.gnome.org/World/Phosh/gmobile"
dependencies = [
  "GLib-2.0",
  "Gio-2.0",
]
devhelp = true
search_index = true

[dependencies."Gio-2.0"]
name = "Gio"
description = "GObject Interfaces and Objects, Networking, IPC, and I/O"
docs_url = "https://docs.gtk.org/gio/"

[dependencies."GLib-2.0"]
name = "GLib"
description = "The base type system library"
docs_url = "https://docs.gtk.org/glib/"

[theme]
name = "basic"
show_index_summary = true
show_class_hierarchy = true

[source-location]
# The base URL for the web UI
base_url = "https://gitlab.gnome.org/World/Phosh/gmobile/-/blob/main/"
# The format for links, using "filename" and "line" for the format
file_format = "{filename}#L{line}"

[extra]
content_files = [
  "build-howto.md",
]
urlmap_file = "urlmap.js"0707010000004D000081A40000000000000000000000016857C08300001668000000000000000000000000000000000000002300000000gmobile-0.4.0/doc/gmobile.udev.rst.. _gmobile.udev(5):

============
gmobile.udev
============

--------------------------------
Device configuration for gmobile
--------------------------------

DESCRIPTION
-----------

``gmobile`` allows one to configure certain aspects through
`udev's hwdb <https://www.freedesktop.org/software/systemd/man/hwdb.html>`_

The following properties are supported:

WAKEUP KEYS
-----------

An input device's wakeup keys specify which keys unblank the screen of
an idle device. By default all keys are wakeup keys. The default can
be changed on a per keyboard level via

::

  GM_WAKEUP_KEY_DEFAULT=0

The behaviour of individual keys can be changed by giving their keycodes e.g.

::

  GM_WAKEUP_KEY_<keycode>=[0|1]

The keycode is the linux event code.

Note that gmobile merely provides that information. The Wayland compositor is
responsible for applying it.

For details on how to add these properties to hwdb see below.

CONFIGURING HWDB
----------------

The hwdb contains a set of match rules that assign udev properties
that become available when the device is connected. This section only
describes the hwdb in relation to gmobile, it is not full
documentation on how the hwdb works. For that please see the
``hwdb(7)`` man page.

gmobile's use of the hwdb is limited to properties systemd and custom
rules files (where available) provide.

.. _hwdb_querying:

.................
Querying the hwdb
.................

gmobile currently only uses device nodes in the form of ``/dev/input/eventX`` where X
is the number of the specific device. Running ``libinput debug-events`` lists
all devices currently available to libinput and their event node name: ::

    $> sudo libinput debug-events
    -event0   DEVICE_ADDED            gpio-keys                         seat0 default group1  cap:k
    -event2   DEVICE_ADDED            30370000.snvs:snvs-powerkey       seat0 default group2  cap:k
    -event3   DEVICE_ADDED            generic ft5x06 (f0)               seat0 default group3  cap:t ntouches 10 calib
    ...

Note the event node name for your device and translate it into a syspath in
the form of ``/sys/class/input/eventX``. This path can be supplied to ``udevadm
info`` ::

    $> udevadm info -p /sys/class/input/event0/
    P: /devices/platform/gpio-keys/input/input0/event0
    M: event0
    R: 0
    U: input
    D: c 13:64
    N: input/event0
    L: 0
    S: input/by-path/platform-gpio-keys-event
    E: DEVPATH=/devices/platform/gpio-keys/input/input0/event0
    E: SUBSYSTEM=input
    E: DEVNAME=/dev/input/event0
    E: MAJOR=13
    E: MINOR=64
    E: USEC_INITIALIZED=5327886
    E: ID_INPUT=1
    E: ID_INPUT_KEY=1
    E: ID_PATH=platform-gpio-keys
    E: ID_PATH_TAG=platform-gpio-keys
    E: GM_WAKEUP_KEY_114=0
    E: GM_WAKEUP_KEY_115=0
    …

Lines starting with ``E:`` are udev properties available to applications. Properties
added by gmobile all have a `GM_` prefix. They are only present if a hwdb entry
matches.

.. _hwdb_reloading:

..................
Reloading the hwdb
..................

The actual hwdb is stored in a binary file on-disk and must be updated
manually whenever a ``.hwdb`` file changes. This is required both when a user
manually edits the ``.hwdb`` file or when gmobile ships an updated set of entries.

To update the binary file on-disk, run: ::

    sudo systemd-hwdb update

Then, to trigger a reload of all properties on your device, run: ::

    sudo udevadm trigger /sys/class/input/eventX

Then check with ``udevadm info`` whether the properties were updated, see
`Querying the hwdb`. If a new property does not appear on the device, use ``udevadm
test`` to check for error messages by udev and the hwdb (e.g. syntax errors
in the udev rules files). ::

    sudo udevadm test /sys/class/input/eventX

.. _hwdb_modifying:

..............................................................................
Modifying the hwdb
..............................................................................

This section applies to users that need to add, change, or remove a hwdb
entry for their device. Note that **the hwdb is not part of the public API
and may change at any time**. Once a device has been made to work, the
change must be submitted to the
`gmobile repository  <https://gitlab.gnome.org/World/Phosh/gmobile>`_.

hwdb entries are only applied if a udev rules calls out to the hwdb with the
right match format. gmobile ships with a set of rules to query the hwdb,
the different rules are reflected by their prefix. Again, **this is not part
of the public API**. gmobile's matches are
composed of a literal "gmobile", then either the device name (prefixed
with `name:`) followed by the machine's first device tree compatible
(prefixed with `dt:`) or dmi modalias. For example:

::

    gmobile:name:gpio-keys:dt:purism,librem5*

The device name is available in the device's `/sys/class/input/eventX/device/name`
while the device tree compatible is available in `/sys/firmware/devicetree/base/compatible`.

The hwdb match string is the first portion of the hwdb entry. The second
portion is the property to set. Each hwdb entry may match on multiple
devices and may apply multiple properties. For example:

::

    gmobile:name:gpio-keys:dt:purism,librem5*
      GM_WAKEUP_KEY_114=0
      GM_WAKEUP_KEY_115=0

In the example above the matching gpio-keys device will have both
properties applied.

The hwdb does not allow removing properties. Where a property must be unset,
it should be set to 0.

For testing any user-specific hwdb entries should be placed in a file
`/etc/udev/hwdb.d/99-gmobile.hwdb` but please make sure to submit them upstream
as the hwdb format might change without notice.

See also
--------

``hwdb(7)`` ``systemd-hwdb(8)`` ``phoc(1)``
0707010000004E000081A40000000000000000000000016857C08300000680000000000000000000000000000000000000001E00000000gmobile-0.4.0/doc/meson.buildif get_option('gtk_doc')

  expand_content_md_files = ['build-howto.md']

  toml_data = configuration_data()
  toml_data.set('VERSION', meson.project_version())

  gmobile_toml = configure_file(
    input: 'gmobile.toml.in',
    output: 'gmobile.toml',
    configuration: toml_data,
  )

  dependency(
    'gi-docgen',
    version: '>= 2021.1',
    fallback: ['gi-docgen', 'dummy_dep'],
    native: true,
    required: get_option('gtk_doc'),
  )

  gidocgen = find_program('gi-docgen')

  docs_dir = datadir / 'doc'

  custom_target(
    'gmobile-doc',
    input: [gmobile_toml, gmobile_gir[0]],
    output: 'gmobile-0',
    command: [
      gidocgen,
      'generate',
      '--quiet',
      '--add-include-path=@0@'.format(meson.current_build_dir() / '../src'),
      '--config=@INPUT0@',
      '--output-dir=@OUTPUT@',
      '--no-namespace-dir',
      '--content-dir=@0@'.format(meson.current_source_dir()),
      '@INPUT1@',
    ],
    depend_files: [expand_content_md_files],
    build_by_default: true,
    install: true,
    install_dir: docs_dir,
  )

endif

if get_option('man')
  manpages = [['gmobile.udev', 5]]

  rst2man = find_program('rst2man', 'rst2man.py', required: false)
  rst2man_flags = ['--syntax-highlight=none']

  foreach manpage : manpages
    man_name = manpage[0]
    man_section = manpage[1]

    custom_target(
      'man-@0@'.format(man_name),
      input: '@0@.rst'.format(man_name),
      output: '@0@.@1@'.format(man_name, man_section),
      command: [rst2man, rst2man_flags, '@INPUT@'],
      capture: true,
      install: true,
      install_dir: get_option('mandir') / 'man@0@'.format(man_section),
    )
  endforeach
endif
0707010000004F000081A40000000000000000000000016857C08300000124000000000000000000000000000000000000001C00000000gmobile-0.4.0/doc/urlmap.js// SPDX-FileCopyrightText: 2024 The Phosh Developers
// SPDX-License-Identifier: GPL-3.0-or-later

baseURLs = [
  [ 'GLib', 'https://docs.gtk.org/glib/' ],
  [ 'GObject', 'https://docs.gtk.org/gobject/' ],
  [ 'Gio', 'https://docs.gtk.org/gio/' ],
  [ 'Gtk', 'https://docs.gtk.org/gtk3/' ]
]
07070100000050000041ED0000000000000000000000026857C08300000000000000000000000000000000000000000000001700000000gmobile-0.4.0/examples07070100000051000081A40000000000000000000000016857C083000016DD000000000000000000000000000000000000003200000000gmobile-0.4.0/examples/gm-display-panel-preview.c/*
 * Copyright (C) 2022 The Phosh Developers
 *
 * SPDX-License-Identifier: GPL-3-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#define GMOBILE_USE_UNSTABLE_API
#include "gmobile.h"

#include <gio/gio.h>
#include <glib/gprintf.h>

static void
print_version (void)
{
  g_printf ("gm-display-panel-preview %s\n", GM_VERSION);
  exit (0);
}

#define X_OFF 5
#define Y_OFF 5

static char *
build_svg (GmDisplayPanel *panel)
{
  GString *svg = g_string_new ("");
  int xres = gm_display_panel_get_x_res (panel);
  int yres = gm_display_panel_get_y_res (panel);
  int radius = gm_display_panel_get_border_radius (panel);
  GListModel *cutouts;

  g_string_append_printf (svg,
    "    <svg width=\"%d\" height=\"%d\">\n"
    "      <g transform=\"translate(%d,%d)\">\n"
    "        <!-- The panel -->\n"
    "        <path d=\"M0 %d"
                    "  a %d %d 0 0 1 %d %d"
                    "  h%d"
                    "  a %d %d 0 0 1 %d %d"
                    "  v%d"
                    "  a %d %d 0 0 1 %d %d"
                    "  h%d"
                    "  a %d %d 0 0 1 %d %d"
                    "  Z \""
                    " stroke=\"black\" stroke-width=\"2\" fill=\"lightgrey\" />\n",
                          xres + 2 * X_OFF, yres + 2 * Y_OFF,
                          X_OFF, Y_OFF,
                          radius,
                          radius, radius, radius, -radius,
                          xres - 2 * radius,
                          radius, radius, radius, radius,
                          yres - 2 * radius,
                          radius, radius, -radius, radius,
                          -xres + 2 * radius,
                          radius, radius, -radius, -radius);

  cutouts = gm_display_panel_get_cutouts (panel);
  for (int i = 0; i < g_list_model_get_n_items (cutouts); i++) {
    g_autoptr (GmCutout) cutout = g_list_model_get_item (cutouts, i);
    if (cutout) {
      const GmRect *bounds = gm_cutout_get_bounds (cutout);
      const char *name = gm_cutout_get_name (cutout) ?: "";
      const char *cutout_path = gm_cutout_get_path (cutout);

      if (cutout_path == NULL) {
        g_warning ("Failed to get cutout path for '%s' - skipping", name);
        continue;
      }

      g_string_append_printf (svg,
    "        <!-- cutout %s -->\n"
    "        <path d=\"%s\" stroke=\"black\" stroke-width=\"2\" fill=\"none\" />\n",
                              name,
                              cutout_path);
      g_string_append_printf (svg,
    "        <!-- bbox of cutout %s -->\n"
    "        <rect x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\""
                        " fill=\"red\" fill-opacity=\"0.1\" />\n",
                              name,
                              bounds->x, bounds->y, bounds->width, bounds->height);
      }
  }

  g_string_append_printf (svg,
     "      </g>\n"
     "    </svg>\n");

  return g_string_free (svg, FALSE);
}


static char *
build_html (GmDisplayPanel *panel)
{
  GString *html = g_string_new ("");
  g_autofree char *svg = NULL;

  svg = build_svg (panel);
  g_string_append_printf (html,
    "<!DOCTYPE html>\n"
    "<html>\n"
    "  <head>\n"
    "    <title>%s</title>\n"
    "    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n"
    "  </head>\n"
    "  <body>\n"
    "%s"
    "  </body>\n"
    "</html>", gm_display_panel_get_name (panel), svg);

  return g_string_free (html, FALSE);
}


int main (int argc, char **argv)
{
  g_autoptr (GOptionContext) opt_context = NULL;
  gboolean version = FALSE;
  gboolean svg = FALSE;
  const char *output_file = NULL;
  g_autofree char *content = NULL;
  g_autoptr (GError) err = NULL;
  g_autoptr (GmDeviceInfo) info = NULL;
  g_auto (GStrv) compatibles = NULL;
  GmDisplayPanel *panel = NULL;
  GStrv compatibles_opt = NULL;

  const GOptionEntry options [] = {
    {"compatible", 'c', 0, G_OPTION_ARG_STRING_ARRAY, &compatibles_opt,
     "Device tree compatibles to use for panel lookup ", NULL},
    {"output", 'o', 0, G_OPTION_ARG_STRING, &output_file,
     "The output file name", NULL},
    {"svg", 's', 0, G_OPTION_ARG_NONE, &svg,
     "Output svg instead of html", NULL},
    {"version", 0, 0, G_OPTION_ARG_NONE, &version,
     "Show version information", NULL},
    { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
  };

  opt_context = g_option_context_new ("- panel preview");
  g_option_context_add_main_entries (opt_context, options, NULL);
  if (!g_option_context_parse (opt_context, &argc, &argv, &err)) {
    g_warning ("%s", err->message);
    g_clear_error (&err);
    return EXIT_FAILURE;
  }

  if (version)
    print_version ();

  if (compatibles_opt && compatibles_opt[0]) {
    compatibles = g_strdupv (compatibles_opt);
  } else {
    compatibles = gm_device_tree_get_compatibles (NULL, &err);
    if (compatibles == NULL) {
      g_critical ("Failed to get compatibles: %s", err->message);
      return EXIT_FAILURE;
    }
  }

  info = gm_device_info_new ((const char *const *)compatibles);
  panel = gm_device_info_get_display_panel (info);
  if (panel == NULL) {
    g_critical ("Failed to find any panel");
    return EXIT_FAILURE;
  }

  if (svg)
    content = build_svg (panel);
  else
    content = build_html (panel);

  if (output_file) {
    g_autoptr (GFile) dest = g_file_new_for_path (output_file);

    if (!g_file_replace_contents (dest,
                                  content,
                                  strlen (content),
                                  NULL, FALSE,
                                  G_FILE_CREATE_REPLACE_DESTINATION,
                                  NULL, NULL,
                                  &err)) {
      g_critical ("Failed to write html: %s", err->message);
      return EXIT_FAILURE;
    }
  } else {
    g_printf ("%s", content);
  }

  return EXIT_SUCCESS;
}
07070100000052000081A40000000000000000000000016857C083000019BE000000000000000000000000000000000000003400000000gmobile-0.4.0/examples/gm-display-panel-run-phosh.c/*
 * Copyright (C) 2022 The Phosh Developers
 *
 * SPDX-License-Identifier: GPL-3-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

/* This examples launches phosh and phoc emulationg the display
   of the given device tree compatible */

#define GMOBILE_USE_UNSTABLE_API
#include "gmobile.h"

#include <glib-unix.h>
#include <glib/gstdio.h>

#include <gio/gio.h>
#include <glib/gprintf.h>

#include <math.h>

#define PHOSH_BIN "/usr/libexec/phosh"

GMainLoop   *loop;
GSubprocess *phoc;

G_NORETURN static void
print_version (void)
{
  g_printf ("gm-emu-device--panel %s\n", GM_VERSION);
  exit (0);
}


static gboolean
on_shutdown_signal (gpointer unused)
{
  g_autoptr (GError) err = NULL;
  gboolean success;

  success = g_subprocess_wait (phoc, NULL, &err);
  if (!success)
    g_warning ("Failed to terminate phoc: %s", err->message);

  g_main_loop_quit (loop);

  return G_SOURCE_REMOVE;
}


static char *
write_phoc_ini (GmDisplayPanel *panel, gdouble scale)
{
  g_autoptr (GError) err = NULL;
  g_autoptr (GString) content = g_string_new ("[output:WL-1]\n");
  g_autofree char *phoc_ini = NULL;
  int xres = gm_display_panel_get_x_res (panel);
  int yres = gm_display_panel_get_y_res (panel);
  int fd;

  g_string_append_printf (content, "mode = %dx%d\n", xres, yres);
  g_string_append_printf (content, "scale = %.2f\n", scale);
  fd = g_file_open_tmp ("phoc_XXXXXX.ini", &phoc_ini, &err);
  if (fd < 0) {
    g_critical ("Failed to open %s: %s", phoc_ini, err->message);
    return NULL;
  }

  if (write (fd, content->str, strlen (content->str)) < 0) {
    g_critical ("Failed to write %s", strerror (errno));
    return NULL;
  }

  return g_steal_pointer (&phoc_ini);
}


/* Auto scale calculation copied verbatim from phoc */

#define MIN_WIDTH       360.0
#define MIN_HEIGHT      540.0
#define MAX_DPI_TARGET  180.0
#define INCH_IN_MM      25.4

static float
phoc_utils_compute_scale (int32_t phys_width, int32_t phys_height,
                          int32_t width, int32_t height)
{
  float dpi, max_scale, scale;

  /* Ensure scaled resolution won't be inferior to minimum values */
  max_scale = fminf (height / MIN_HEIGHT, width / MIN_WIDTH);

  /*
   * Round the maximum scale to a sensible value:
   *   - never use a scaling factor < 1
   *   - round to the lower 0.25 step below 2
   *   - round to the lower 0.5 step between 2 and 3
   *   - round to the lower integer value over 3
   */
  if (max_scale < 1) {
    max_scale = 1;
  } else if (max_scale < 2) {
    max_scale = 0.25 * floorf (max_scale / 0.25);
  } else if (max_scale < 3) {
    max_scale = 0.5 * floorf (max_scale / 0.5);
  } else {
    max_scale = floorf (max_scale);
  }

  dpi = (float) height / (float) phys_height * INCH_IN_MM;
  scale = fminf (ceilf (dpi / MAX_DPI_TARGET), max_scale);

  return scale;
}



int main (int argc, char **argv)
{
  g_autoptr (GOptionContext) opt_context = NULL;
  gboolean version = FALSE;
  g_autoptr (GError) err = NULL;
  g_autoptr (GmDeviceInfo) info = NULL;
  g_auto (GStrv) compatibles = NULL;
  GmDisplayPanel *panel = NULL;
  GStrv compatibles_opt = NULL;
  g_autofree char *phoc_ini = NULL;
  g_autoptr (GSubprocessLauncher) phoc_launcher = NULL;
  double scale_opt = -1.0;
  const char *phosh_bin;

  const GOptionEntry options [] = {
    {"compatible", 'c', 0, G_OPTION_ARG_STRING_ARRAY, &compatibles_opt,
     "Device tree compatibles to use for panel lookup ", NULL},
    {"scale", 's', 0, G_OPTION_ARG_DOUBLE, &scale_opt,
     "The display scale", NULL },
    {"version", 0, 0, G_OPTION_ARG_NONE, &version,
     "Show version information", NULL},
    { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
  };

  opt_context = g_option_context_new ("- emulate display panel");
  g_option_context_add_main_entries (opt_context, options, NULL);
  if (!g_option_context_parse (opt_context, &argc, &argv, &err)) {
    g_warning ("%s", err->message);
    g_clear_error (&err);
    return EXIT_FAILURE;
  }

  if (version)
    print_version ();

  if (compatibles_opt && compatibles_opt[0]) {
    compatibles = g_strdupv (compatibles_opt);
  } else {
    compatibles = gm_device_tree_get_compatibles (NULL, &err);
    if (compatibles == NULL) {
      g_critical ("Failed to get compatibles: %s", err->message);
      return EXIT_FAILURE;
    }
  }

  info = gm_device_info_new ((const char *const *)compatibles);
  panel = gm_device_info_get_display_panel (info);
  if (panel == NULL) {
    g_critical ("Failed to find any panel");
    return EXIT_FAILURE;
  }

  if (scale_opt < 0) {
    scale_opt = phoc_utils_compute_scale (gm_display_panel_get_width (panel),
                                          gm_display_panel_get_height (panel),
                                          gm_display_panel_get_x_res (panel),
                                          gm_display_panel_get_y_res (panel));
    g_message ("Using scale %f", scale_opt);
  }

  phoc_ini = write_phoc_ini (panel, scale_opt);
  if (!phoc_ini)
    return EXIT_FAILURE;

  g_message ("Using %s as phoc config", phoc_ini);

  phosh_bin = g_getenv ("PHOSH_BIN") ?: PHOSH_BIN;
  phoc_launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_SEARCH_PATH_FROM_ENVP);
  g_subprocess_launcher_set_environ (phoc_launcher, NULL);
  g_subprocess_launcher_setenv (phoc_launcher, "WLR_BACKENDS", "wayland", TRUE);
  g_subprocess_launcher_setenv (phoc_launcher, "GSETTINGS_BACKEND", "memory", TRUE);
  g_subprocess_launcher_setenv (phoc_launcher, "PHOC_DEBUG", "cutouts", TRUE);
  g_subprocess_launcher_setenv (phoc_launcher, "PHOSH_DEBUG", "fake-builtin", TRUE);
  g_subprocess_launcher_setenv (phoc_launcher, "G_MESSAGES_DEBUG", "phosh-layout-manager", TRUE);
  if (compatibles_opt && compatibles_opt[0]) {
    g_autofree char *opt = g_strjoinv (",", compatibles_opt);
    g_subprocess_launcher_setenv (phoc_launcher, "GMOBILE_DT_COMPATIBLES", opt, TRUE);
  }
  g_subprocess_launcher_setenv (phoc_launcher, "WLR_BACKENDS", "wayland", TRUE);

  phoc = g_subprocess_launcher_spawnv (phoc_launcher,
                                       (const char * const [])
                                       { "phoc", "-C", phoc_ini,
                                         "-E", phosh_bin, NULL },
                                       &err);
  g_unix_signal_add (SIGTERM, on_shutdown_signal, NULL);
  g_unix_signal_add (SIGINT, on_shutdown_signal, NULL);

  loop = g_main_loop_new (NULL, FALSE);

  g_message  ("Launching phosh and phoc, hit CTRL-C to quit");
  g_main_loop_run (loop);

  g_unlink (phoc_ini);

  g_clear_object (&phoc);
  g_clear_object (&loop);

  return EXIT_SUCCESS;
}
07070100000053000081A40000000000000000000000016857C08300000905000000000000000000000000000000000000002400000000gmobile-0.4.0/examples/gm-timeout.c/*
 * Copyright (C) 2022 Purism SPC
 *
 * SPDX-License-Identifier: GPL-3-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

/* Wait for n seconds taking suspend/resume into account */


#define GMOBILE_USE_UNSTABLE_API
#include "gmobile.h"

#include <glib/gprintf.h>


static void
print_version (void)
{
  g_printf ("gm-timeout %s - Wait a bit\n", GM_VERSION);
  exit (0);
}


static void
print_now (void)
{
  g_autoptr (GDateTime) now = g_date_time_new_now_local ();

  g_message ("Now %.2d:%.2d:%.2d",
	     g_date_time_get_hour (now),
	     g_date_time_get_minute (now),
	     g_date_time_get_second (now));
}


static void
on_timeout (gpointer data)
{
  g_main_loop_quit (data);

  g_message ("Exiting main loop");
}


int
main (int argc, char **argv)
{
  g_autoptr(GOptionContext) opt_context = NULL;
  g_autoptr (GMainLoop) loop = NULL;
  g_autoptr (GError) err = NULL;
  int seconds = 60;
  gboolean version = FALSE, wakeup = FALSE;

  const GOptionEntry options [] = {
    {"seconds", 's', 0, G_OPTION_ARG_INT, &seconds,
     "Sleep for that many seconds", NULL},
    {"wakeup", 'w',  0, G_OPTION_ARG_NONE, &wakeup,
     "Wakeup system if needed", NULL},
    {"version", 0, 0, G_OPTION_ARG_NONE, &version,
     "Show version information", NULL},
    { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
  };

  opt_context = g_option_context_new ("- Wait a bit");
  g_option_context_add_main_entries (opt_context, options, NULL);
  if (!g_option_context_parse (opt_context, &argc, &argv, &err)) {
    g_warning ("%s", err->message);
    g_clear_error (&err);
    return 1;
  }

  if (version)
    print_version ();

  loop = g_main_loop_new (NULL, FALSE);

  if (wakeup) {
    int id;
    g_message ("Arming wakeup timer with %d seconds", seconds);
    id = gm_wakeup_timeout_add_seconds_once (seconds,
                                             on_timeout,
                                             loop,
                                             &err);
    if (!id) {
      g_warning ("Failed to create timer: %s", err->message);
      return EXIT_FAILURE;
    }
  } else {
    g_message ("Arming timer with %d seconds", seconds);
    gm_timeout_add_seconds_once (seconds, on_timeout, loop);
  }

  print_now ();
  g_main_loop_run (loop);

  print_now ();

  return EXIT_SUCCESS;
}
07070100000054000081A40000000000000000000000016857C08300000213000000000000000000000000000000000000002300000000gmobile-0.4.0/examples/meson.buildif get_option('examples')

  example_timeout = executable(
    'gm-timeout',
    ['gm-timeout.c'],
    dependencies: [gmobile_shared_dep],
    install: true,
  )

  example_display_panel_preview = executable(
    'gm-display-panel-preview',
    ['gm-display-panel-preview.c'],
    dependencies: [gmobile_shared_dep],
    install: true,
  )

  example_display_panel_run_phosh = executable(
    'gm-display-panel-run-phosh',
    ['gm-display-panel-run-phosh.c'],
    dependencies: [gmobile_shared_dep],
    install: true,
  )

endif
07070100000055000081A40000000000000000000000016857C083000003EE000000000000000000000000000000000000001B00000000gmobile-0.4.0/gmobile.doap<?xml version="1.0" encoding="UTF-8"?>
<Project xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
         xmlns:foaf="http://xmlns.com/foaf/0.1/"
         xmlns:gnome="http://api.gnome.org/doap-extensions#"
         xmlns="http://usefulinc.com/ns/doap#">

  <name>gmobile</name>
  <shortname>gmobile</shortname>
  <shortdesc>Classes and utilities for mobile devices</shortdesc>
  <description>
    gmobile aims to make developing GLib/GObject based software for
    mobile devices running Linux easier.
  </description>
  <homepage rdf:resource="https://gitlab.gnome.org/World/Phosh/gmobile" />
  <license rdf:resource="http://usefulinc.com/doap/licenses/lgpl" />

  <programming-language>C</programming-language>

  <maintainer>
    <foaf:Person>
      <foaf:name>Guido Günther</foaf:name>
      <foaf:mbox rdf:resource="mailto:agx@sigxcpu.org" />
      <gnome:userid>guidog</gnome:userid>
    </foaf:Person>
  </maintainer>

</Project>
07070100000056000081A40000000000000000000000016857C08300000B4F000000000000000000000000000000000000001A00000000gmobile-0.4.0/meson.buildproject(
  'gmobile',
  'c',
  version: '0.4.0',
  license: 'LGPLv2.1+',
  meson_version: '>= 0.56.1',
  default_options: ['warning_level=1', 'buildtype=debugoptimized', 'c_std=gnu11'],
)

cc = meson.get_compiler('c')

prefix = get_option('prefix')
bindir = prefix / get_option('bindir')
datadir = prefix / get_option('datadir')
localedir = prefix / get_option('localedir')
libdir = prefix / get_option('libdir')
libexecdir = prefix / get_option('libexecdir')
pkgdatadir = datadir / meson.project_name()
pkglibdir = libdir / meson.project_name()
udevdir = prefix / 'lib' / 'udev'
vapidir = datadir / 'vala' / 'vapi'
installed_tests_metadir = datadir / 'installed-tests' / meson.project_name()
installed_tests_execdir = libexecdir / 'installed-tests' / meson.project_name()

global_c_args = ['-DGMOBILE_COMPILATION']

test_c_args = [
  '-Wcast-align',
  '-Wdate-time',
  '-Wdeclaration-after-statement',
  ['-Werror=format-security', '-Werror=format=2'],
  '-Wendif-labels',
  '-Werror=incompatible-pointer-types',
  '-Werror=missing-declarations',
  '-Werror=overflow',
  '-Werror=return-type',
  '-Werror=shift-count-overflow',
  '-Werror=shift-overflow=2',
  '-Werror=implicit-fallthrough=3',
  '-Wfloat-equal',
  '-Wformat-nonliteral',
  '-Wformat-security',
  '-Winit-self',
  '-Wmaybe-uninitialized',
  '-Wmissing-field-initializers',
  '-Wmissing-include-dirs',
  '-Wmissing-noreturn',
  '-Wnested-externs',
  '-Wno-missing-field-initializers',
  '-Wno-sign-compare',
  '-Wno-strict-aliasing',
  '-Wno-unused-parameter',
  '-Wold-style-definition',
  '-Wpointer-arith',
  '-Wredundant-decls',
  '-Wshadow',
  '-Wstrict-prototypes',
  '-Wswitch-default',
  '-Wswitch-enum',
  '-Wtype-limits',
  '-Wundef',
  '-Wunused-function',
]
if get_option('buildtype') != 'plain'
  test_c_args += '-fstack-protector-strong'
endif

epoll_dep = dependency('epoll-shim', required: false)
glib_dep = dependency('glib-2.0', version: '>=2.78')
gio_dep = dependency('gio-2.0', version: '>=2.78')
json_glib_dep = dependency(
  'json-glib-1.0',
  version: '>= 1.6.2',
  fallback: ['json-glib', 'json_glib_dep'],
)

foreach arg : test_c_args
  if cc.has_multi_arguments(arg)
    global_c_args += arg
  endif
endforeach

gnome = import('gnome')

add_project_arguments(global_c_args, language: 'c')

config_h = configuration_data()
config_h.set_quoted('GM_VERSION', meson.project_version())

root_inc = include_directories('.')
gm_config_h = configure_file(output: 'gm-config.h', configuration: config_h)

subdir('data')
subdir('src')
subdir('tests')
subdir('examples')
subdir('doc')

summary(
  {
    'Examples': get_option('examples'),
    'Tests': get_option('tests'),
    'Introspection': get_option('introspection'),
    'VAPI': get_option('vapi'),
    'Documentation': get_option('gtk_doc'),
    'Manual pages': get_option('man'),
    'Hwdb': get_option('hwdb'),
  },
  bool_yn: true,
  section: 'Build',
)
07070100000057000081A40000000000000000000000016857C083000003B2000000000000000000000000000000000000002000000000gmobile-0.4.0/meson_options.txtoption('examples',
       type: 'boolean', value: true,
       description: 'Whether to compile the examples')

option('tests',
       type: 'boolean', value: true,
       description: 'Whether to compile unit tests')

option('installed_tests',
       type: 'boolean', value: false,
       description: 'Whether to install the tests')

option('gtk_doc',
       type: 'boolean', value: false,
       description: 'Whether to generate the API reference')

option('man',
       type: 'boolean', value: false,
       description : 'Whether to generate man pages (requires rst2man)')

option('introspection', type: 'boolean', value: true,
       description : 'Build introspection data (requires gobject-introspection)')

option('vapi', type: 'boolean', value: true,
       description : 'Build vapi (requires introspection)')

option('hwdb',
       type: 'boolean', value: true,
       description : 'Whether to install udev rules and hwdb entries')
07070100000058000041ED0000000000000000000000026857C08300000000000000000000000000000000000000000000001200000000gmobile-0.4.0/src07070100000059000081A40000000000000000000000016857C0830000160F000000000000000000000000000000000000001E00000000gmobile-0.4.0/src/gm-cutout.c/*
 * Copyright (C) 2022 The Phosh Developers
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#include "gm-cutout.h"
#include "gm-rect.h"
#include "gm-svg-path.h"

#include <gio/gio.h>

/**
 * GmCutout:
 *
 * A display cutout or notch.
 *
 * A display cutout is an area of a display that is not usable for
 * rendering e.g.  because a camera or speaker is placed there. This
 * includes so called "notches".  The are needs to be avoided when
 * rendering. It is described by a SVG path. Each cutouts coordinate
 * systems is located at the top left display corner in the displays
 * natural orientation. Applications can query the area to avoid
 * for rendering via the `bounds` property so they don't need to
 * deal with the SVG path themselves.
 *
 * Since: 0.0.2
 */

enum {
  PROP_0,
  PROP_NAME,
  PROP_PATH,
  PROP_BOUNDS,
  PROP_LAST_PROP
};
static GParamSpec *props[PROP_LAST_PROP];

struct _GmCutout {
  GObject   parent;

  char     *name;
  char     *path;
  GmRect    bounds;
};

G_DEFINE_TYPE (GmCutout, gm_cutout, G_TYPE_OBJECT);

static gboolean
gm_cutout_set_path (GmCutout *self, const char *path, GError **err)
{
  g_autoptr (GError) local_err = NULL;
  int x1, y1, x2, y2;

  if (g_strcmp0 (self->path, path) == 0)
    return TRUE;

  if (gm_svg_path_get_bounding_box (path, &x1, &x2, &y1, &y2, &local_err) == FALSE) {
    if (err)
      *err = g_error_copy (local_err);
    /* Tracking errors when setting properties can be hard so make it
     * simple to get some debugging */
    g_debug ("Failed to parse bounding box for %s: %s", path, local_err->message);
    return FALSE;
  }

  g_free (self->path);
  self->path = g_strdup (path);

  self->bounds.x = x1;
  self->bounds.y = y1;
  self->bounds.width = x2 - x1;
  self->bounds.height = y2 - y1;

  return TRUE;
}


static void
gm_cutout_set_property (GObject      *object,
                        guint         property_id,
                        const GValue *value,
                        GParamSpec   *pspec)
{
  GmCutout *self = GM_CUTOUT (object);

  switch (property_id) {
  case PROP_NAME:
    g_free (self->name);
    self->name = g_value_dup_string (value);
    break;
  case PROP_PATH:
    gm_cutout_set_path (self, g_value_get_string (value), NULL);
    break;
  default:
    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
    break;
  }
}


static void
gm_cutout_get_property (GObject    *object,
                        guint       property_id,
                        GValue     *value,
                        GParamSpec *pspec)
{
  GmCutout *self = GM_CUTOUT (object);

  switch (property_id) {
  case PROP_NAME:
    g_value_set_string (value, gm_cutout_get_name (self));
    break;
  case PROP_PATH:
    g_value_set_string (value, gm_cutout_get_path (self));
    break;
  case PROP_BOUNDS:
    g_value_set_boxed (value, gm_cutout_get_bounds (self));
    break;
  default:
    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
    break;
  }
}


static void
gm_cutout_finalize (GObject *object)
{
  GmCutout *self = GM_CUTOUT (object);

  g_clear_pointer (&self->name, g_free);
  g_clear_pointer (&self->path, g_free);

  G_OBJECT_CLASS (gm_cutout_parent_class)->finalize (object);
}


static void
gm_cutout_class_init (GmCutoutClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);

  object_class->get_property = gm_cutout_get_property;
  object_class->set_property = gm_cutout_set_property;
  object_class->finalize = gm_cutout_finalize;

  /**
   * GmCutout:name:
   *
   * A name identifying the cutout.
   *
   * Since: 0.0.2
   */
  props[PROP_NAME] =
    g_param_spec_string ("name", "", "",
                         NULL,
                         G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY);
  /**
   * GmCutout:path:
   *
   * The SVG path that describes the display cutout or notch.
   *
   * Since: 0.0.2
   */
  props[PROP_PATH] =
    g_param_spec_string ("path", "", "",
                         NULL,
                         G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY);
  /**
   * GmCutout:bounds:
   *
   * Rectangular bounds of the cutout
   *
   * Since: 0.0.2
   */
  props[PROP_BOUNDS] =
    g_param_spec_boxed ("bounds", "", "",
                        GM_TYPE_RECT,
                        G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);

  g_object_class_install_properties (object_class, PROP_LAST_PROP, props);
}


static void
gm_cutout_init (GmCutout *self)
{
}

/**
 * gm_cutout_new:
 * @path: An svg path
 *
 * Create a new cutout based on the given SVG path.
 *
 * Returns: The cutout.
 *
 * Since: 0.0.2
 */
GmCutout *
gm_cutout_new (const char *path)
{
  return GM_CUTOUT (g_object_new (GM_TYPE_CUTOUT, "path", path, NULL));
}

/**
 * gm_cutout_get_name:
 * @self: A cutout
 *
 * The name of the cutout.
 *
 * Returns: The cutout's name.
 *
 * Since: 0.0.2
 */
const char *
gm_cutout_get_name (GmCutout *self)
{
  g_return_val_if_fail (GM_IS_CUTOUT (self), NULL);

  return self->name;
}

/**
 * gm_cutout_get_path:
 * @self: A cutout
 *
 * Gets the SVG path describing the shape of the cutout.
 *
 * Returns: The cutout's shape as SVG path
 *
 * Since: 0.0.2
 */
const char *
gm_cutout_get_path (GmCutout *self)
{
  g_return_val_if_fail (GM_IS_CUTOUT (self), NULL);

  return self->path;
}

/**
 * gm_cutout_get_bounds:
 * @self: A cutout
 *
 * Gets the bounding box of the cutout.
 *
 * Returns: The bounding box.
 *
 * Since: 0.0.2
 */
const GmRect *
gm_cutout_get_bounds (GmCutout *self)
{
  g_return_val_if_fail (GM_IS_CUTOUT (self), NULL);

  return &self->bounds;
}
0707010000005A000081A40000000000000000000000016857C083000001FE000000000000000000000000000000000000001E00000000gmobile-0.4.0/src/gm-cutout.h/*
 * Copyright (C) 2022 The Phosh Developers
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */

#pragma once

#include "gm-rect.h"

#include <glib-object.h>

G_BEGIN_DECLS

#define GM_TYPE_CUTOUT (gm_cutout_get_type ())

G_DECLARE_FINAL_TYPE (GmCutout, gm_cutout, GM, CUTOUT, GObject)

GmCutout      *gm_cutout_new (const char *path);
const char    *gm_cutout_get_name (GmCutout *self);
const char    *gm_cutout_get_path (GmCutout *self);
const GmRect  *gm_cutout_get_bounds (GmCutout *self);

G_END_DECLS
0707010000005B000081A40000000000000000000000016857C08300001129000000000000000000000000000000000000002300000000gmobile-0.4.0/src/gm-device-info.c/*
 * Copyright (C) 2022-2023 The Phosh Developers
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#include "gm-config.h"

#include "gm-device-info.h"
#include "gm-display-panel.h"

#define GM_RESOURCE_PREFIX "/org/gnome/gmobile/"
#define GM_DISPLAY_PANEL_RESOURCE_PREFIX GM_RESOURCE_PREFIX "devices/display-panels/"

/**
 * GmDeviceInfo:
 *
 * Get device dependent information.
 *
 * Allows to query device dependent information from different
 * sources (currently we only look a the built-in gresources).
 *
 * The lookups are currently based on device tree compatibles.
 * See [func@device_tree_get_compatibles].
 *
 * Since: 0.0.1
 */

enum {
  PROP_0,
  PROP_COMPATIBLES,
  PROP_LAST_PROP
};
static GParamSpec *props[PROP_LAST_PROP];

struct _GmDeviceInfo {
  GObject         parent;

  GStrv           compatibles;
  GmDisplayPanel *panel;
};
G_DEFINE_TYPE (GmDeviceInfo, gm_device_info, G_TYPE_OBJECT)


static void
gm_device_info_set_property (GObject      *object,
                             guint         property_id,
                             const GValue *value,
                             GParamSpec   *pspec)
{
  GmDeviceInfo *self = GM_DEVICE_INFO (object);

  switch (property_id) {
  case PROP_COMPATIBLES:
    g_strfreev (self->compatibles);
    self->compatibles = g_value_dup_boxed (value);
    break;
  default:
    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
    break;
  }
}


static void
gm_device_info_get_property (GObject    *object,
                             guint       property_id,
                             GValue     *value,
                             GParamSpec *pspec)
{
  GmDeviceInfo *self = GM_DEVICE_INFO (object);

  switch (property_id) {
  case PROP_COMPATIBLES:
    g_value_set_boxed (value, self->compatibles);
    break;
  default:
    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
    break;
  }
}


static void
gm_device_info_finalize (GObject *object)
{
  GmDeviceInfo *self = GM_DEVICE_INFO(object);

  g_clear_object (&self->panel);
  g_clear_pointer (&self->compatibles, g_strfreev);

  G_OBJECT_CLASS (gm_device_info_parent_class)->finalize (object);
}


static void
gm_device_info_class_init (GmDeviceInfoClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);

  object_class->get_property = gm_device_info_get_property;
  object_class->set_property = gm_device_info_set_property;
  object_class->finalize = gm_device_info_finalize;

  /**
   * GmDeviceInfo:compatibles:
   *
   * The compatibles to look up device information for.
   *
   * Since: 0.0.1
   */
  props[PROP_COMPATIBLES] =
    g_param_spec_boxed ("compatibles", "", "",
                        G_TYPE_STRV,
                        G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);

  g_object_class_install_properties (object_class, PROP_LAST_PROP, props);
}


static void
gm_device_info_init (GmDeviceInfo *self)
{
}

/**
 * gm_device_info_new:
 * @compatibles: device tree compatibles
 *
 * Gets device information based on the passed in device tree compatibles.
 *
 * Returns: The known device information
 *
 * Since: 0.0.1
 */
GmDeviceInfo *
gm_device_info_new (const char * const *compatibles)
{
  return GM_DEVICE_INFO (g_object_new (GM_TYPE_DEVICE_INFO,
                                       "compatibles", compatibles,
                                       NULL));
}

/**
 * gm_device_info_get_display_panel:
 * @self: The device info
 *
 * Gets display panel information. Queries the database for the best
 * matching panel based on the device's compatibles.
 *
 * Returns:(transfer none): The display panel information
 *
 * Since: 0.0.1
 */
GmDisplayPanel *
gm_device_info_get_display_panel (GmDeviceInfo *self)
{
  GmDisplayPanel *panel = NULL;

  g_return_val_if_fail (GM_IS_DEVICE_INFO (self), NULL);
  g_return_val_if_fail (self->compatibles, NULL);

  if (self->panel)
    return self->panel;

  for (int i = 0; self->compatibles[i] != NULL; i++) {
    g_autofree char *filename = g_strdup_printf ("%s.json", self->compatibles[i]);
    g_autofree char *resource = NULL;

    resource = g_build_path ("/", GM_DISPLAY_PANEL_RESOURCE_PREFIX, filename, NULL);
    panel = gm_display_panel_new_from_resource (resource, NULL);
    if (panel) {
      self->panel = panel;
      break;
    }
  }

  return self->panel;
}
0707010000005C000081A40000000000000000000000016857C08300000213000000000000000000000000000000000000002300000000gmobile-0.4.0/src/gm-device-info.h/*
 * Copyright (C) 2022-2023 The Phosh Developers
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#pragma once

#include "gm-display-panel.h"

#include <glib-object.h>

G_BEGIN_DECLS

#define GM_TYPE_DEVICE_INFO (gm_device_info_get_type ())

G_DECLARE_FINAL_TYPE (GmDeviceInfo, gm_device_info, GM, DEVICE_INFO, GObject)

GmDeviceInfo    *gm_device_info_new (const char * const *compatibles);
GmDisplayPanel  *gm_device_info_get_display_panel (GmDeviceInfo *self);

G_END_DECLS
0707010000005D000081A40000000000000000000000016857C0830000094E000000000000000000000000000000000000002300000000gmobile-0.4.0/src/gm-device-tree.c/*
 * Copyright (C) 2022 The Phosh Developers
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#include "gm-device-tree.h"

#include <gio/gio.h>
#include <glib.h>

#define DT_COMPATIBLE_PATH "firmware/devicetree/base/compatible"

static GStrv
get_env_compatibles (void)
{
  const char *env = g_getenv ("GMOBILE_DT_COMPATIBLES");

  if (env)
    return g_strsplit(env, ":", -1);

  return NULL;
}

/**
 * gm_device_tree_get_compatibles:
 * @sysfs_root: Path where /sys is mounted. Defaults to `/sys` if %NULL is passed.
 * @err: return location for error or %NULL
 *
 * Read compatible machine types from
 * `sysfs_root/firmware/devicetree/base/compatible` on Linux.
 * If the path doesn't exist or host is not Linux return %NULL.
 *
 * For debugging purposes `GMOBILE_DT_COMPATIBLES` can be set to a `:`
 * separated list of compatibles which will be returned instead.
 *
 * Returns:(transfer full): compatible machine types or %NULL
 *
 * Since: 0.0.1
 */
GStrv
gm_device_tree_get_compatibles (const char *sysfs_root, GError **err)
{
  GStrv env_compatibles;
#ifdef __linux__
  gsize len;
  g_autoptr (GPtrArray) parts = NULL;
  g_autofree char *compatible_path = NULL;
  g_autofree gchar *compatibles = NULL;
  const char *comp;

  g_return_val_if_fail (err == NULL || *err == NULL, NULL);

  env_compatibles = get_env_compatibles();
  if (env_compatibles)
    return env_compatibles;

  compatible_path = g_build_filename (sysfs_root ?: "/sys",
                                      DT_COMPATIBLE_PATH, NULL);
  if (g_file_test (compatible_path, (G_FILE_TEST_EXISTS)) == FALSE) {
    g_set_error (err, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
                 "%s not found", compatible_path);
    return NULL;
  }

  if (!g_file_get_contents (compatible_path, &compatibles, &len, err)) {
    return NULL;
  }

  parts = g_ptr_array_new ();
  comp = compatibles;
  while (comp - compatibles < len) {
    g_ptr_array_add (parts, (gpointer) g_strdup (comp));
    comp = strchr (comp, 0);
    comp++;
  }
  g_ptr_array_add (parts, NULL);
  return (GStrv) g_ptr_array_steal (parts, NULL);
#else
  env_compatibles = get_env_compatibles();
  if (env_compatibles)
    return env_compatibles;

  g_set_error_literal (err, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
                       "Not supported on this platform");
  return NULL;
#endif
}
0707010000005E000081A40000000000000000000000016857C0830000019E000000000000000000000000000000000000002300000000gmobile-0.4.0/src/gm-device-tree.h/*
 * Copyright (C) 2022 The Phosh Developers
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#pragma once

#if !defined(_GMOBILE_INSIDE) && !defined(GMOBILE_COMPILATION)
#error "Only <gmobile.h> can be included directly."
#endif

#include <glib.h>

G_BEGIN_DECLS

GStrv       gm_device_tree_get_compatibles (const char *sysfs_root, GError **err);

G_END_DECLS
0707010000005F000081A40000000000000000000000016857C08300003247000000000000000000000000000000000000002500000000gmobile-0.4.0/src/gm-display-panel.c/*
 * Copyright (C) 2022-2023 The Phosh Developers
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#include "gm-cutout.h"
#include "gm-display-panel.h"
#include "gm-main.h"

#include <json-glib/json-glib.h>

/**
 * GmDisplayPanel:
 *
 * Physical properties of a display panel like size, cutouts and
 * rounded corners.
 *
 * Since: 0.0.1
 */

enum {
  PROP_0,
  PROP_NAME,
  PROP_CUTOUTS,
  PROP_X_RES,
  PROP_Y_RES,
  PROP_WIDTH,
  PROP_HEIGHT,
  PROP_BORDER_RADIUS,
  PROP_LAST_PROP
};
static GParamSpec *props[PROP_LAST_PROP];

struct _GmDisplayPanel {
  GObject     parent;

  char       *name;
  GListStore *cutouts;
  int         x_res;
  int         y_res;
  int         border_radius;
  int         width;
  int         height;
};

static void gm_display_panel_json_serializable_iface_init (JsonSerializableIface *iface);

G_DEFINE_TYPE_WITH_CODE (GmDisplayPanel, gm_display_panel, G_TYPE_OBJECT,
                         G_IMPLEMENT_INTERFACE (JSON_TYPE_SERIALIZABLE,
                                                gm_display_panel_json_serializable_iface_init));

static void
gm_display_panel_set_property (GObject      *object,
                               guint         property_id,
                               const GValue *value,
                               GParamSpec   *pspec)
{
  GmDisplayPanel *self = GM_DISPLAY_PANEL (object);

  switch (property_id) {
  case PROP_NAME:
    g_free (self->name);
    self->name = g_value_dup_string (value);
    break;
  case PROP_CUTOUTS:
    g_set_object (&self->cutouts, g_value_get_object (value));
    break;
  case PROP_X_RES:
    self->x_res = g_value_get_int (value);
    break;
  case PROP_Y_RES:
    self->y_res = g_value_get_int (value);
    break;
  case PROP_BORDER_RADIUS:
    self->border_radius = g_value_get_int (value);
    break;
  case PROP_WIDTH:
    self->width = g_value_get_int (value);
    break;
  case PROP_HEIGHT:
    self->height = g_value_get_int (value);
    break;
  default:
    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
    break;
  }
}


static void
gm_display_panel_get_property (GObject    *object,
                               guint       property_id,
                               GValue     *value,
                               GParamSpec *pspec)
{
  GmDisplayPanel *self = GM_DISPLAY_PANEL (object);

  switch (property_id) {
  case PROP_NAME:
    g_value_set_string (value, self->name);
    break;
  case PROP_CUTOUTS:
    g_value_set_object (value, self->cutouts);
    break;
  case PROP_X_RES:
    g_value_set_int (value, gm_display_panel_get_x_res (self));
    break;
  case PROP_Y_RES:
    g_value_set_int (value, gm_display_panel_get_y_res (self));
    break;
  case PROP_BORDER_RADIUS:
    g_value_set_int (value, gm_display_panel_get_border_radius (self));
    break;
  case PROP_WIDTH:
    g_value_set_int (value, gm_display_panel_get_width (self));
    break;
  case PROP_HEIGHT:
    g_value_set_int (value, gm_display_panel_get_height (self));
    break;
  default:
    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
    break;
  }
}


static JsonNode *
gm_display_panel_serializable_serialize_property (JsonSerializable *serializable,
                                                  const gchar      *property_name,
                                                  const GValue     *value,
                                                  GParamSpec       *pspec)
{
  GmDisplayPanel *self = GM_DISPLAY_PANEL (serializable);
  JsonNode *node = NULL;

  if (g_strcmp0 (property_name, "cutouts") == 0) {
    JsonArray *array = json_array_sized_new (1);

    for (int i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (self->cutouts)); i++) {
      g_autoptr (GObject) cutout = g_list_model_get_item (G_LIST_MODEL (self->cutouts), i);
      json_array_add_element (array, json_gobject_serialize (cutout));
    }
    node = json_node_init_array (json_node_alloc (), array);
  } else {
    node = json_serializable_default_serialize_property (serializable,
                                                         property_name,
                                                         value,
                                                         pspec);
  }
  return node;
}


static gboolean
gm_display_panel_serializable_deserialize_property (JsonSerializable *serializable,
                                                    const gchar      *property_name,
                                                    GValue           *value,
                                                    GParamSpec       *pspec,
                                                    JsonNode         *property_node)
{
  if (g_strcmp0 (property_name, "cutouts") == 0) {
    if (JSON_NODE_TYPE (property_node) == JSON_NODE_NULL) {
      g_value_set_pointer (value, NULL);
      return TRUE;
    } else if (JSON_NODE_TYPE (property_node) == JSON_NODE_ARRAY) {
      JsonArray *array = json_node_get_array (property_node);
      guint array_len = json_array_get_length (array);
      GListStore *cutouts = g_list_store_new (GM_TYPE_CUTOUT);

      for (int i = 0; i < array_len; i++) {
        JsonNode *element_node = json_array_get_element (array, i);
        GmCutout *cutout;

	if (JSON_NODE_HOLDS_OBJECT (element_node)) {
	  cutout = GM_CUTOUT (json_gobject_deserialize (GM_TYPE_CUTOUT, element_node));
          g_list_store_append (cutouts, cutout);
	} else {
	  return FALSE;
	}
      }
      g_value_set_object (value, cutouts);
      return TRUE;
    }
    return FALSE;
  } else {
    return json_serializable_default_deserialize_property (serializable,
							   property_name,
							   value,
							   pspec,
							   property_node);
  }
  return FALSE;
}


static void
gm_display_panel_json_serializable_iface_init (JsonSerializableIface *iface)
{
  iface->serialize_property = gm_display_panel_serializable_serialize_property;
  iface->deserialize_property = gm_display_panel_serializable_deserialize_property;
}


static void
gm_display_panel_finalize (GObject *object)
{
  GmDisplayPanel *self = GM_DISPLAY_PANEL(object);

  g_clear_object (&self->cutouts);
  g_clear_pointer (&self->name, g_free);

  G_OBJECT_CLASS (gm_display_panel_parent_class)->finalize (object);
}


static void
gm_display_panel_class_init (GmDisplayPanelClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);

  object_class->get_property = gm_display_panel_get_property;
  object_class->set_property = gm_display_panel_set_property;
  object_class->finalize = gm_display_panel_finalize;

  /**
   * GmDisplayPanel:name:
   *
   * The name of the display
   *
   * Since: 0.0.1
   */
  props[PROP_NAME] =
    g_param_spec_string ("name", "", "",
                         NULL,
                         G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);

  /**
   * GmDisplayPanel:cutouts:
   *
   * The display cutouts as `GListModel` of [class@Cutout].
   *
   * Since: 0.0.1
   */
  props[PROP_CUTOUTS] =
    g_param_spec_object ("cutouts", "", "",
                         G_TYPE_LIST_STORE,
                         G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
  /**
   * GmDisplayPanel:x-res:
   *
   * The panel resolution in pixels in the x direction
   *
   * Since: 0.0.1
   */
  props[PROP_X_RES] =
    g_param_spec_int ("x-res", "", "",
                      0, G_MAXINT, 0,
                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
  /**
   * GmDisplayPanel:y-res:
   *
   * The panel resolution in pixels in the y direction
   *
   * Since: 0.0.1
   */
  props[PROP_Y_RES] =
    g_param_spec_int ("y-res", "", "",
                      0, G_MAXINT, 0,
                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
  /**
   * GmDisplayPanel:border-radius:
   *
   * The border radius of the panel edges in device pixels
   * If a single border radius isn't enough use multiple [type@Cutout].
   *
   * Since: 0.0.1
   */
  props[PROP_BORDER_RADIUS] =
    g_param_spec_int ("border-radius", "", "",
                      0, G_MAXINT, 0,
                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
  /**
   * GmDisplayPanel:width:
   *
   * The display width in millimeters
   *
   * Since: 0.0.1
   */
  props[PROP_WIDTH] =
    g_param_spec_int ("width", "", "",
                      0, G_MAXINT, 0,
                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
  /**
   * GmDisplayPanel:height:
   *
   * The display height in millimeters
   *
   * Since: 0.0.1
   */
  props[PROP_HEIGHT] =
    g_param_spec_int ("height", "", "",
                      0, G_MAXINT, 0,
                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);

  g_object_class_install_properties (object_class, PROP_LAST_PROP, props);
}


static void
gm_display_panel_init (GmDisplayPanel *self)
{
  self->cutouts = g_list_store_new (GM_TYPE_CUTOUT);
}

/**
 * gm_display_panel_new:
 *
 * Constructs a new display panel object.
 *
 * Returns: The new display panel object
 *
 * Since: 0.0.1
 */
GmDisplayPanel *
gm_display_panel_new (void)
{
  return GM_DISPLAY_PANEL (g_object_new (GM_TYPE_DISPLAY_PANEL, NULL));
}

/**
 * gm_display_panel_new_from_data:
 * @data: The panel's data as JSON
 * @error: Return location for an error
 *
 * Constructs a new display panel based on the given data. If that fails
 * `NULL` is returned and `error` describes the error that occurred.
 *
 * Returns: The new display panel object
 *
 * Since: 0.0.1
 */
GmDisplayPanel *
gm_display_panel_new_from_data (const gchar *data, GError **error)
{
  g_autoptr (JsonNode) node = json_from_string(data, error);
  if (!node)
    return NULL;

  return GM_DISPLAY_PANEL (json_gobject_deserialize (GM_TYPE_DISPLAY_PANEL, node));
}

/**
 * gm_display_panel_new_from_resource:
 * @resource_name: A path to a gresource
 * @error: Return location for an error
  *
 * Constructs a new display panel by fetching the data from the given
 * GResource. If that fails `NULL` is returned and `error` describes
 * the error that occurred.
 *
 * Returns: The new display panel object
 *
 * Since: 0.0.1
 */
GmDisplayPanel *
gm_display_panel_new_from_resource (const gchar *resource_name, GError **error)
{
  g_autoptr (GBytes) bytes = NULL;

  g_return_val_if_fail (resource_name && resource_name[0], NULL);

  /* Make sure resources are initialized */
  gm_init ();

  bytes = g_resources_lookup_data (resource_name, 0, error);
  if (bytes == NULL)
    return NULL;

  return GM_DISPLAY_PANEL (gm_display_panel_new_from_data ((const char *)g_bytes_get_data (bytes, NULL),
                                                           error));
}

/**
 * gm_display_panel_get_name:
 *
 * Gets the panel's name.
 *
 * Returns: The panel's name
 *
 * Since: 0.0.1
 */
const char *
gm_display_panel_get_name (GmDisplayPanel *self)
{
  g_return_val_if_fail (GM_IS_DISPLAY_PANEL (self), NULL);

  return self->name;
}

/**
 * gm_display_panel_get_cutouts:
 * @self: The display panel
 *
 * Get the display cutouts.
 *
 * Returns: (transfer none): The display cutouts
 *
 * Since: 0.0.1
 */
GListModel *
gm_display_panel_get_cutouts (GmDisplayPanel *self)
{
  g_return_val_if_fail (GM_IS_DISPLAY_PANEL (self), NULL);

  return G_LIST_MODEL (self->cutouts);
}

/**
 * gm_display_panel_get_x_res:
 * @self: The display panel
 *
 * Gets the panels resolution (in pixels) in the x direction
 *
 * Returns: The x resolution.
 *
 * Since: 0.0.1
 */
int
gm_display_panel_get_x_res (GmDisplayPanel *self)
{
  g_return_val_if_fail (GM_IS_DISPLAY_PANEL (self), 0);

  return self->x_res;
}

/**
 * gm_display_panel_get_y_res:
 * @self: The display panel
 *
 * Gets the panels resolution (in pixels) in the y direction.
 *
 * Returns: The y resolution.
 *
 * Since: 0.0.1
 */
int
gm_display_panel_get_y_res (GmDisplayPanel *self)
{
  g_return_val_if_fail (GM_IS_DISPLAY_PANEL (self), 0);

  return self->y_res;
}

/**
 * gm_display_panel_get_border_radius:
 * @self: The display panel
 *
 * Gets the panels border radius. 0 indicates rectangular corners.  If
 * given applies to all corners of the panel.
 *
 * Returns: The panel's border radius.
 *
 * Since: 0.0.1
 */
int
gm_display_panel_get_border_radius (GmDisplayPanel *self)
{
  g_return_val_if_fail (GM_IS_DISPLAY_PANEL (self), 0);

  return self->border_radius;
}

/**
 * gm_display_panel_get_width:
 * @self: The display panel
 *
 * Gets the panels width in mm.
 *
 * Returns: The panel's width.
 *
 * Since: 0.0.1
 */
int
gm_display_panel_get_width (GmDisplayPanel *self)
{
  g_return_val_if_fail (GM_IS_DISPLAY_PANEL (self), 0);

  return self->width;
}

/**
 * gm_display_panel_get_height:
 * @self: The display panel
 *
 * Gets the panels height in mm.
 *
 * Returns: The panel's height.
 *
 * Since: 0.0.1
 */
int
gm_display_panel_get_height (GmDisplayPanel *self)
{
  g_return_val_if_fail (GM_IS_DISPLAY_PANEL (self), 0);

  return self->height;
}
07070100000060000081A40000000000000000000000016857C0830000046C000000000000000000000000000000000000002500000000gmobile-0.4.0/src/gm-display-panel.h/*
 * Copyright (C) 2022-2023 The Phosh Developers
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#pragma once

#include <glib-object.h>
#include <gio/gio.h>

G_BEGIN_DECLS

#define GM_TYPE_DISPLAY_PANEL (gm_display_panel_get_type ())

G_DECLARE_FINAL_TYPE (GmDisplayPanel, gm_display_panel, GM, DISPLAY_PANEL, GObject)

GmDisplayPanel     *gm_display_panel_new (void);
GmDisplayPanel     *gm_display_panel_new_from_data (const gchar *data, GError **error);
GmDisplayPanel     *gm_display_panel_new_from_resource (const char *resource_name, GError **error);
const char         *gm_display_panel_get_name (GmDisplayPanel *self);
GListModel         *gm_display_panel_get_cutouts (GmDisplayPanel *self);
int                 gm_display_panel_get_x_res (GmDisplayPanel *self);
int                 gm_display_panel_get_y_res (GmDisplayPanel *self);
int                 gm_display_panel_get_border_radius (GmDisplayPanel *self);
int                 gm_display_panel_get_width (GmDisplayPanel *self);
int                 gm_display_panel_get_height (GmDisplayPanel *self);

G_END_DECLS
07070100000061000081A40000000000000000000000016857C0830000013C000000000000000000000000000000000000001D00000000gmobile-0.4.0/src/gm-error.c/*
 * Copyright (C) 2022 The Phosh Developers
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#include "gm-error.h"

/**
 * gm_error_quark:
 *
 * Gets the GM Error Quark.
 *
 * Returns: a #GQuark.
 *
 * Since: 0.0.1
 **/
G_DEFINE_QUARK (gm-error-quark, gm_error)
07070100000062000081A40000000000000000000000016857C083000001BE000000000000000000000000000000000000001D00000000gmobile-0.4.0/src/gm-error.h/*
 * Copyright (C) 2022 Purism SPC
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#pragma once

#include <glib.h>

/**
 * GmError:
 * @GM_ERROR_PARSING_FAILED: Parsing of the given data failed.
 *
 * Error codes returned by gmobile functions.
 *
 * Since: 0.0.1
 */
typedef enum {
  GM_ERROR_PARSING_FAILED = 1,
} GmError;

#define GM_ERROR (gm_error_quark())

GQuark gm_error_quark (void);
07070100000063000081A40000000000000000000000016857C083000002C0000000000000000000000000000000000000001C00000000gmobile-0.4.0/src/gm-main.c/*
 * Copyright (C) 2022-2023 The Phosh Developers
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#include "gm-main.h"
#include "gm-resources.h"

/**
 * gm_init:
 *
 * Call this function to initialize the library explicitly. This makes
 * the embedded device information available.
 *
 * Since: 0.0.1
 */
void
gm_init (void)
{
  static gsize initialized = FALSE;

  if (g_once_init_enter (&initialized)) {
    /*
     * gmobile is currently meant as static library so register
     * resources explicitly.  otherwise they get dropped during static
     * linking
     */
    gm_register_resource ();
    g_once_init_leave (&initialized, TRUE);
  }
}
07070100000064000081A40000000000000000000000016857C08300000166000000000000000000000000000000000000001C00000000gmobile-0.4.0/src/gm-main.h/*
 * Copyright (C) 2022 The Phosh Developers
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#pragma once

#if !defined(_GMOBILE_INSIDE) && !defined(GMOBILE_COMPILATION)
#error "Only <gmobile.h> can be included directly."
#endif

#include <glib.h>

G_BEGIN_DECLS

void       gm_init (void);

G_END_DECLS
07070100000065000081A40000000000000000000000016857C083000013AF000000000000000000000000000000000000001F00000000gmobile-0.4.0/src/gm-mcc-mnc.c/*
 * Copyright (C) 2025 The Phosh Developers
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * Taken from gnome-calls which took it from Chatty
 *
 * Author(s): Mohammed Sadiq <sadiq@sadiqpk.org>
 *            Guido Günther <agx@sigxcpu.org>
 **/

#include <gm-error.h>
#include <gm-mcc-mnc.h>

#include <gio/gio.h>

struct mcc_list {
  guint mcc;
  char  code[3];
};

/*
 * Extracted from:
 * https://www.itu.int/dms_pub/itu-t/opb/sp/T-SP-E.212B-2018-PDF-E.pdf
 */
struct mcc_list mcc_list[] = {
  {202, "GR"},
  {204, "NL"},
  {206, "BE"},
  {208, "FR"},
  {212, "MC"},
  {213, "AD"},
  {214, "ES"},
  {216, "HU"},
  {218, "BA"},
  {219, "HR"},
  {220, "RS"},
  {221, "XK"},
  {222, "IT"},
  {225, "VA"},
  {226, "RO"},
  {228, "CH"},
  {230, "CZ"},
  {231, "SK"},
  {232, "AT"},
  {234, "GB"},
  {235, "GB"},
  {238, "DK"},
  {240, "SE"},
  {242, "NO"},
  {244, "FI"},
  {246, "LT"},
  {247, "LV"},
  {248, "EE"},
  {250, "RU"},
  {255, "UA"},
  {257, "BY"},
  {259, "MD"},
  {260, "PL"},
  {262, "DE"},
  {266, "GI"},
  {268, "PT"},
  {270, "LU"},
  {272, "IE"},
  {274, "IS"},
  {276, "AL"},
  {278, "MT"},
  {280, "CY"},
  {282, "GE"},
  {283, "AM"},
  {284, "BG"},
  {286, "TR"},
  {288, "FO"},
  {290, "GL"},
  {292, "SM"},
  {293, "SI"},
  {294, "MK"},
  {295, "LI"},
  {297, "ME"},
  {302, "CA"},
  {308, "PM"},
  {310, "US"},
  {311, "US"},
  {312, "US"},
  {313, "US"},
  {314, "US"},
  {315, "US"},
  {316, "US"},
  {330, "PR"},
  {332, "VI"},
  {334, "MX"},
  {338, "JM"},
  /* Guadeloupe and Martinique are part of France */
  {340, "GP"},
  {340, "MQ"},
  {342, "BB"},
  {344, "AG"},
  {346, "KY"},
  {348, "VG"},
  {350, "BM"},
  {352, "GD"},
  {354, "MS"},
  {356, "KN"},
  {358, "LC"},
  {360, "VC"},
  {362, "CW"},
  {363, "AW"},
  {364, "BS"},
  {365, "AI"},
  {366, "DM"},
  {368, "CU"},
  {370, "DO"},
  {372, "HT"},
  {374, "TT"},
  {376, "TC"},
  {400, "AZ"},
  {401, "KZ"},
  {402, "BT"},
  {404, "IN"},
  {405, "IN"},
  {406, "IN"},
  {410, "PK"},
  {412, "AF"},
  {413, "LK"},
  {414, "MM"},
  {415, "LB"},
  {416, "JO"},
  {417, "SY"},
  {418, "IQ"},
  {419, "KW"},
  {420, "SA"},
  {421, "YE"},
  {422, "OM"},
  {424, "AE"},
  {425, "IL"},
  {426, "BH"},
  {427, "QA"},
  {428, "MN"},
  {429, "NP"},
  {430, "AE"},
  {431, "AE"},
  {432, "IR"},
  {434, "UZ"},
  {436, "TJ"},
  {437, "KG"},
  {438, "TM"},
  {440, "JP"},
  {441, "JP"},
  {450, "KP"},
  {452, "VN"},
  {454, "HK"},
  {455, "MO"},
  {456, "KH"},
  {457, "LA"},
  {460, "CN"},
  {461, "CN"},
  {466, "TW"},
  {467, "KR"},
  {470, "BD"},
  {472, "MV"},
  {502, "MY"},
  {505, "AU"},
  {510, "ID"},
  {514, "TL"},
  {515, "PH"},
  {520, "TH"},
  {525, "SG"},
  {528, "BN"},
  {530, "NZ"},
  {536, "NR"},
  {537, "PG"},
  {539, "TO"},
  {540, "SB"},
  {541, "VU"},
  {542, "FJ"},
  {543, "WF"},
  {544, "AS"},
  {545, "KI"},
  {546, "NC"},
  {547, "PF"},
  {548, "CK"},
  {549, "AS"},
  {550, "FM"},
  {551, "MH"},
  {552, "PW"},
  {553, "TV"},
  {554, "TK"},
  {555, "NU"},
  {602, "EG"},
  {603, "DZ"},
  {604, "MA"},
  {605, "TN"},
  {606, "LY"},
  {607, "GM"},
  {608, "SN"},
  {609, "MR"},
  {610, "ML"},
  {611, "GN"},
  {612, "CI"},
  {613, "BF"},
  {614, "NE"},
  {615, "TG"},
  {616, "BJ"},
  {617, "MU"},
  {618, "LR"},
  {619, "SL"},
  {620, "GH"},
  {621, "NG"},
  {622, "TD"},
  {623, "CF"},
  {624, "CM"},
  {625, "CV"},
  {626, "ST"},
  {627, "GQ"},
  {628, "GA"},
  {629, "CG"},
  {630, "CD"},
  {631, "AO"},
  {632, "GW"},
  {633, "SC"},
  {634, "SD"},
  {635, "RW"},
  {636, "ET"},
  {637, "SO"},
  {638, "DJ"},
  {639, "KE"},
  {640, "TZ"},
  {641, "UG"},
  {642, "BI"},
  {643, "MZ"},
  {645, "ZM"},
  {646, "MG"},
  {647, "RE"},
  {648, "ZW"},
  {649, "NA"},
  {650, "MW"},
  {651, "LS"},
  {652, "BW"},
  {653, "SZ"},
  {654, "KM"},
  {655, "ZA"},
  {657, "ER"},
  {658, "SH"},
  {659, "SS"},
  {702, "BZ"},
  {704, "GT"},
  {706, "SV"},
  {708, "HN"},
  {710, "NI"},
  {712, "CR"},
  {714, "PA"},
  {716, "PE"},
  {722, "AR"},
  {724, "BR"},
  {730, "CL"},
  {732, "CO"},
  {734, "VE"},
  {736, "BO"},
  {738, "GY"},
  {740, "EC"},
  {742, "GF"},
  {744, "PY"},
  {746, "SR"},
  {748, "UY"},
  {750, "FK"},
};

/**
 * gm_mcc_to_iso:
 * @mcc: The mcc
 * @error: The error
 *
 * Get the ISO 3316-1 country code based on a given mobile country
 * code (MCC). It's sufficient for the given string to have the
 * MCC as prefix. In other words it is o.k. to pass an IMSI.
 *
 * On error `NULL` is returned and `errror` is set.
 *
 * Returns: The country code or NULL.
 */
const char *
gm_mcc_to_iso (const char *mcc, GError **err)
{
  g_autofree char *str = NULL;
  guint64 num;

  if (!mcc || strlen (mcc) < 3) {
    g_set_error (err, GM_ERROR, G_IO_ERROR_NOT_FOUND, "Invalid MCC code: %s", mcc);
    return NULL;
  }

  str = g_strndup (mcc, 3);
  num = g_ascii_strtoull (str, NULL, 10);

  for (guint i = 0; i < G_N_ELEMENTS (mcc_list); i++)
    if (mcc_list[i].mcc == num)
      return mcc_list[i].code;

  g_set_error (err, GM_ERROR, G_IO_ERROR_NOT_FOUND, "Invalid MCC code: %" G_GUINT64_FORMAT, num);

  return NULL;
}
07070100000066000081A40000000000000000000000016857C083000000E1000000000000000000000000000000000000001F00000000gmobile-0.4.0/src/gm-mcc-mnc.h/*
 * Copyright (C) 2025 The Phosh Developers
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */

#pragma once

#include <glib.h>

G_BEGIN_DECLS

const char * gm_mcc_to_iso (const char *mcc_str, GError **err);

G_END_DECLS
07070100000067000081A40000000000000000000000016857C083000002B8000000000000000000000000000000000000001C00000000gmobile-0.4.0/src/gm-rect.c/*
 * Copyright (C) 2022 The Phosh Developers
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#include "gm-rect.h"

/**
 * GmRect:
 * @x: x coordindate of the upper, left corner
 * @y: y coordindate of the upper, left corner
 * @width: the width of the rectangle
 * @height: the height of the rectangle
 *
 * A rectangle.
 *
 * Similar to GdkRectangle but we don't want to pull in gtk/gdk.
 *
 * Since: 0.0.1
 */

static GmRect *
gm_rect_copy (const GmRect *self)
{
  GmRect *copy = g_new (GmRect, 1);
  *copy = *self;

  return copy;
}


/* TODO: transform from/to GdkRectangle */
G_DEFINE_BOXED_TYPE (GmRect, gm_rect, gm_rect_copy, g_free);
07070100000068000081A40000000000000000000000016857C083000001EF000000000000000000000000000000000000001C00000000gmobile-0.4.0/src/gm-rect.h/*
 * Copyright (C) 2022 The Phosh Developers
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#include <glib-object.h>

#pragma once

#if !defined(_GMOBILE_INSIDE) && !defined(GMOBILE_COMPILATION)
#error "Only <gmobile.h> can be included directly."
#endif

G_BEGIN_DECLS

typedef struct _GmRect {
  int x, y;
  int width, height;
} GmRect;

GType gm_rect_get_type (void) G_GNUC_CONST;

#define GM_TYPE_RECT (gm_rect_get_type ())

G_END_DECLS
07070100000069000081A40000000000000000000000016857C083000038EF000000000000000000000000000000000000002000000000gmobile-0.4.0/src/gm-svg-path.c/*
 * Copyright (C) 2022 The Phosh Developers
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#include "gm-error.h"
#include "gm-rect.h"
#include "gm-svg-path.h"

#include <math.h>


struct bbox {
  int x1, x2, y1, y2;

  int cx, cy;
};


struct fbbox {
  double x1, x2, y1, y2;
};


static void
swap (double *a, double *b)
{
  double tmp = *a;

  *a = *b;
  *b = tmp;
}

static double
bbox_quad_deriv (double start, double control, double end)
{
  double t;

  /* control point between start and end, nothing to do */
  if ((control > start &&  control < end) || (control > end && control < start))
    return start;

  t = ((start - control) / (start - (2 * control) + end));
  return start * ((1 - t) * (1 - t)) + 2 * control * (1 - t) * t + end * t * t;
}

/*
 * See https://pomax.github.io/bezierinfo/ ,
 *     http://pomax.nihongoresources.com/pages/bezier/
 */
static struct fbbox
bbox_quadratic_bezier (double x1, double y1,
                       double x2, double y2,
                       double x3, double y3)
{
  struct fbbox bbox = { 0.0 };
  double x, y;

  bbox.x1 = fmin (x1, x3);
  bbox.y1 = fmin (y1, y3);
  bbox.x2 = fmax (x1, x3);
  bbox.y2 = fmax (y1, y3);

  x = bbox_quad_deriv (x1, x2, x3);
  if (x < bbox.x1)
    bbox.x1 = x;
  else if (x > bbox.x2)
    bbox.x2 = x;

  y = bbox_quad_deriv (y1, y2, y3);
  if (y < bbox.y1)
    bbox.y1 = y;
  else if (y > bbox.y2)
    bbox.y2 = y;

  return bbox;
}


static inline double
bbox_arc_get_angle (double bx, double by)
{
  return fmod (2 * M_PI + (by > 0.0 ? 1.0 : -1.0) *
               acos ( bx / sqrt (bx * bx + by * by) ), 2 * M_PI);
}

/* See https://fridrich.blogspot.com/2011/06/bounding-box-of-svg-elliptical-arc.html */
static struct fbbox
bbox_arc (double x1, double y1,
          double rx, double ry, double phi, gboolean large_arc, gboolean sweep,
          double x2, double y2)
{
  struct fbbox bbox;
  gboolean other_arc;
  const double x1prime = cos (phi)*(x1 - x2)/2 + sin (phi)*(y1 - y2) / 2;
  const double y1prime = -sin (phi)*(x1 - x2)/2 + cos (phi)*(y1 - y2) / 2;
  double txmin, txmax, tymin, tymax, cx, cy, radicant, angle1, angle2;
  double cxprime = 0.0;
  double cyprime = 0.0;

  if (rx < 0.0)
    rx *= -1.0;
  if (ry < 0.0)
    ry *= -1.0;

  if (G_APPROX_VALUE (rx, 0.0, DBL_EPSILON) ||
      G_APPROX_VALUE (ry, 0.0, DBL_EPSILON)) {
    bbox.x1 = (x1 < x2 ? x1 : x2);
    bbox.x2 = (x1 > x2 ? x1 : x2);
    bbox.y1 = (y1 < y2 ? y1 : y2);
    bbox.y2 = (y1 > y2 ? y1 : y2);
    return bbox;
  }

  radicant = (rx*rx*ry*ry - rx*rx*y1prime*y1prime - ry*ry*x1prime*x1prime);
  radicant /= (rx*rx*y1prime*y1prime + ry*ry*x1prime*x1prime);
  if (radicant < 0.0) {
    double ratio = rx/ry;
    double rad = y1prime * y1prime + x1prime * x1prime / (ratio * ratio);
    if (rad < 0.0) {
      bbox.x1 = (x1 < x2 ? x1 : x2);
      bbox.x2 = (x1 > x2 ? x1 : x2);
      bbox.y1 = (y1 < y2 ? y1 : y2);
      bbox.y2 = (y1 > y2 ? y1 : y2);
      return bbox;
    }
    ry =sqrt (rad);
    rx = ratio * ry;
  } else {
    double factor = ((large_arc == sweep) ? -1.0 : 1.0) * sqrt (radicant);

    cxprime = factor * rx* y1prime / ry;
    cyprime = -factor * ry * x1prime / rx;
  }

  cx = cxprime * cos (phi) - cyprime * sin (phi) + (x1 + x2) / 2;
  cy = cxprime * sin (phi) + cyprime * cos (phi) + (y1 + y2) / 2;

  if (G_APPROX_VALUE (phi, 0.0, DBL_EPSILON) ||
      G_APPROX_VALUE (phi, M_PI, DBL_EPSILON)) {
    bbox.x1 = cx - rx;
    txmin = bbox_arc_get_angle (-rx, 0);
    bbox.x2 = cx + rx;
    txmax = bbox_arc_get_angle (rx, 0);
    bbox.y1 = cy - ry;
    tymin = bbox_arc_get_angle (0, -ry);
    bbox.y2 = cy + ry;
    tymax = bbox_arc_get_angle (0, ry);
  } else if (G_APPROX_VALUE (phi, M_PI / 2.0, DBL_EPSILON) ||
             G_APPROX_VALUE (phi, 3.0 * M_PI / 2.0, DBL_EPSILON)) {
    bbox.x1 = cx - ry;
    txmin = bbox_arc_get_angle (-ry, 0);
    bbox.x2 = cx + ry;
    txmax = bbox_arc_get_angle (ry, 0);
    bbox.y1 = cy - rx;
    tymin = bbox_arc_get_angle (0, -rx);
    bbox.y2 = cy + rx;
    tymax = bbox_arc_get_angle (0, rx);
  } else {
    double tmp_x, tmp_y;
    txmin = -atan (ry*tan (phi)/rx);
    txmax = M_PI - atan (ry*tan (phi)/rx);
    bbox.x1 = cx + rx * cos (txmin) * cos (phi) - ry * sin (txmin) * sin (phi);
    bbox.x2 = cx + rx * cos (txmax) * cos (phi) - ry * sin (txmax) * sin (phi);
    if (bbox.x1 > bbox.x2) {
      swap (&bbox.x1, &bbox.x2);
      swap (&txmin, &txmax);
    }
    tmp_y = cy + rx * cos (txmin) * sin (phi) + ry * sin (txmin) * cos (phi);
    txmin = bbox_arc_get_angle (bbox.x1 - cx, tmp_y - cy);
    tmp_y = cy + rx * cos (txmax) * sin (phi) + ry * sin (txmax) * cos (phi);
    txmax = bbox_arc_get_angle (bbox.x2 - cx, tmp_y - cy);

    tymin = atan (ry / (tan (phi) * rx));
    tymax = atan (ry / (tan (phi) * rx)) + M_PI;
    bbox.y1 = cy + rx * cos (tymin) * sin (phi) + ry * sin (tymin) * cos (phi);
    bbox.y2 = cy + rx * cos (tymax) * sin (phi) + ry * sin (tymax) * cos (phi);
    if (bbox.y1 > bbox.y2) {
      swap (&bbox.y1, &bbox.y2);
      swap (&tymin, &tymax);
    }
    tmp_x = cx + rx * cos (tymin) * cos (phi) - ry * sin (tymin) * sin (phi);
    tymin = bbox_arc_get_angle (tmp_x - cx, bbox.y1 - cy);
    tmp_x = cx + rx * cos (tymax) * cos (phi) - ry * sin (tymax) * sin (phi);
    tymax = bbox_arc_get_angle (tmp_x - cx, bbox.y2 - cy);
  }

  angle1 = bbox_arc_get_angle (x1 - cx, y1 - cy);
  angle2 = bbox_arc_get_angle (x2 - cx, y2 - cy);

  if (!sweep)
    swap (&angle1, &angle2);

  other_arc = FALSE;
  if (angle1 > angle2) {
    swap (&angle1, &angle2);
    other_arc = TRUE;
  }

  if ((!other_arc && (angle1 > txmin || angle2 < txmin)) ||
      (other_arc && !(angle1 > txmin || angle2 < txmin)))
    bbox.x1 = x1 < x2 ? x1 : x2;
  if ((!other_arc && (angle1 > txmax || angle2 < txmax)) ||
      (other_arc && !(angle1 > txmax || angle2 < txmax)))
    bbox.x2 = x1 > x2 ? x1 : x2;
  if ((!other_arc && (angle1 > tymin || angle2 < tymin)) ||
      (other_arc && !(angle1 > tymin || angle2 < tymin)))
    bbox.y1 = y1 < y2 ? y1 : y2;
  if ((!other_arc && (angle1 > tymax || angle2 < tymax)) ||
      (other_arc && !(angle1 > tymax || angle2 < tymax)))
    bbox.y2 = y1 > y2 ? y1 : y2;

  return bbox;
}


static gboolean
parse_int (const char *str, int *number, GError **err)
{
  gint64 nl;
  char *endptr;

  if (str == NULL) {
    g_set_error_literal (err, GM_ERROR, GM_ERROR_PARSING_FAILED, "empty string is not a number");
    return FALSE;
  }

  nl  = g_ascii_strtoll (str, &endptr, 10);
  if (nl == 0 && str == endptr) {
    g_set_error (err, GM_ERROR, GM_ERROR_PARSING_FAILED, "'%s' not a number", str);
    return FALSE;
  }

  if (ABS (nl) > G_MAXINT) {
    g_set_error (err, GM_ERROR, GM_ERROR_PARSING_FAILED, "'%s' too large", str);
    return FALSE;
  }

  *number = nl;
  return TRUE;
}


static void
extend_bbox_by_point (struct bbox *bbox, int x, int y)
{
  if (x < bbox->x1)
    bbox->x1 = x;
  if (x > bbox->x2)
    bbox->x2 = x;

  if (y < bbox->y1)
    bbox->y1 = y;
  if (y > bbox->y2)
    bbox->y2 = y;

  bbox->cx = x;
  bbox->cy = y;
}


static void
extend_bbox_by_frect (struct bbox *bbox, struct fbbox *rect)
{
  if (rect->x1 < bbox->x1)
    bbox->x1 = rect->x1;
  if (rect->x2 > bbox->x2)
    bbox->x2 = rect->x2;
  if (rect->y1 < bbox->y1)
    bbox->y1 = rect->y1;
  if (rect->y2 > bbox->y2)
    bbox->y2 = rect->y2;
}


static gboolean
is_command (char c)
{
  switch (c) {
  case 'A': /* arc */
  case 'a':
  case 'C': /* cubic bezier */
  case 'c':
  case 'H': /* horizonal line */
  case 'h':
  case 'L': /* line */
  case 'l':
  case 'M': /* move to */
  case 'm':
  case 'Q': /* quadratic bezier (TBD) */
  case 'q':
  case 'S': /* shortcut cubic bezier (TBD) */
  case 's':
  case 'T': /* shortcut quadratic bezier (TBD) */
  case 't':
  case 'V': /* vertical line */
  case 'v':
  case 'Z': /* close path */
    return TRUE;
  default:
    return FALSE;
  }
}


static char *
normalize_path (const char *path)
{
  GString *canon = g_string_new ("");
  char *norm;

  for (int i = 0; path[i] != '\0'; i++) {
    if (path[i] == ',' || path[i] == '\n' || path[i] == '\t') {
      /* Comma works like whitespace */
      g_string_append_c (canon, ' ');
    } else if (is_command (path[i])) {
      /* Make sure there's whitespace after each command */
      g_string_append_c (canon, path[i]);
      /* Make sure there's whitespace after each command */
      g_string_append_c (canon, ' ');
    } else {
      g_string_append_c (canon, path[i]);
    }
  }

  norm = g_string_free (canon, FALSE);

  return g_strstrip (norm);
}


/**
 * gm_svg_path_get_bounding_box:
 * @path: An SVG path
 * @x1: The lower x coordinate
 * @x2: The upper x coordinate
 * @y1: The lower y coordinate
 * @y2: The upper x coordinate
 * @err: Return location for an error
 *
 * Returns the bounding box of an SVG path. As this is meant for
 * display cutouts we operate on integer (whole pixel) values.  When
 * parsing fails, `FALSE` is returned and `error` contains the error
 * information.
 *
 * Returns: `TRUE` when parsing was successful, `FALSE` otherwise.
 *
 * See https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths for path syntax introduction.
 *
 * Since: 0.0.1
 */
gboolean
gm_svg_path_get_bounding_box (const char *path, int *x1, int *x2, int *y1, int *y2, GError **err)
{
  g_auto (GStrv) parts = NULL;
  g_autoptr (GRegex) whitespace = NULL;
  g_autofree char *norm = NULL;
  struct bbox bbox = { G_MAXINT, 0, G_MAXINT, 0 };

  g_return_val_if_fail (err == NULL || *err == NULL, FALSE);

  norm = normalize_path (path);

  whitespace = g_regex_new (" +", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, err);
  g_return_val_if_fail (whitespace, FALSE);
  parts = g_regex_split (whitespace, norm, G_REGEX_MATCH_DEFAULT);

  for (int i = 0; parts[i] != NULL; i++) {
    const char *cmd = parts[i];
    int x, y, dx, dy;
    gboolean rel = FALSE;

    switch (cmd[0]) {
    case 'M': /* x,y */
    case 'L':
      i++;
      if (parse_int (parts[i], &x, err) == FALSE)
        return FALSE;
      i++;
      if (parse_int (parts[i], &y, err) == FALSE)
        return FALSE;
      extend_bbox_by_point (&bbox, x, y);
      break;
    case 'm': /* dx,dy */
    case 'l':
      i++;
      if (parse_int (parts[i], &dx, err) == FALSE)
        return FALSE;
      i++;
      if (parse_int (parts[i], &dy, err) == FALSE)
        return FALSE;
      extend_bbox_by_point (&bbox, bbox.cx + dx, bbox.cy + dy);
      break;
    case 'V': /* y */
      i++;
      if (parse_int (parts[i], &y, err) == FALSE)
        return FALSE;
      extend_bbox_by_point (&bbox, bbox.cx, y);
      break;
    case 'v': /* dy */
      i++;
      if (parse_int (parts[i], &dy, err) == FALSE)
        return FALSE;
      extend_bbox_by_point (&bbox, bbox.cx, bbox.cy + dy);
      break;
    case 'H': /* x */
      i++;
      if (parse_int (parts[i], &x, err) == FALSE)
        return FALSE;
      extend_bbox_by_point (&bbox, x, bbox.cy);
      break;
    case 'h': /* dx */
      i++;
      if (parse_int (parts[i], &dx, err) == FALSE)
        return FALSE;
      extend_bbox_by_point (&bbox, bbox.cx + dx, bbox.cy);
      break;
    case 'a':
      rel = TRUE;
      G_GNUC_FALLTHROUGH;
    case 'A': { /* rx ry x-axis-rotation large-arc-flag sweep-flag x y */
      int rx, ry, xrot;
      gboolean large, sweep;
      struct fbbox fbox;

      i++;
      if (parse_int (parts[i], &rx, err) == FALSE)
        return FALSE;
      i++;
      if (parse_int (parts[i], &ry, err) == FALSE)
        return FALSE;
      i++;
      if (parse_int (parts[i], &xrot, err) == FALSE)
        return FALSE;
      i++;
      if (parse_int (parts[i], &large, err) == FALSE)
        return FALSE;
      i++;
      if (parse_int (parts[i], &sweep, err) == FALSE)
        return FALSE;
      i++;
      if (parse_int (parts[i], &x, err) == FALSE)
        return FALSE;
      i++;
      if (parse_int (parts[i], &y, err) == FALSE)
        return FALSE;

      if (rel) {
        x = bbox.cx + x;
        y = bbox.cy + y;
      }

      fbox = bbox_arc (bbox.cx, bbox.cy,
                       rx, ry, xrot, !!large, !!sweep,
                       x, y);
      extend_bbox_by_frect (&bbox, &fbox);
      bbox.cx = x;
      bbox.cy = y;
      break;
    }
    case 'q':
      rel = TRUE;
      G_GNUC_FALLTHROUGH;
    case 'Q': {
      int cx, cy;
      struct fbbox fbox;

      /* control point */
      i++;
      if (parse_int (parts[i], &cx, err) == FALSE)
        return FALSE;
      i++;
      if (parse_int (parts[i], &cy, err) == FALSE)
        return FALSE;
      /* end */
      i++;
      if (parse_int (parts[i], &x, err) == FALSE)
        return FALSE;
      i++;
      if (parse_int (parts[i], &y, err) == FALSE)
        return FALSE;

      if (rel) {
        cx = bbox.cx + cx;
        cy = bbox.cy + cy;
        x  = bbox.cx + x;
        y  = bbox.cy + y;
      }

      fbox = bbox_quadratic_bezier (bbox.cx, bbox.cy, cx, cy, x, y);
      extend_bbox_by_frect (&bbox, &fbox);
      bbox.cx = x;
      bbox.cy = y;
      break;
    }
    case 'c':
      rel = TRUE;
      G_GNUC_FALLTHROUGH;
    case 'C': {
      int cx1, cy1, cx2, cy2;

      /* control point 1 */
      i++;
      if (parse_int (parts[i], &cx1, err) == FALSE)
        return FALSE;
      i++;
      if (parse_int (parts[i], &cy1, err) == FALSE)
        return FALSE;
      i++;
      if (parse_int (parts[i], &cx2, err) == FALSE)
        return FALSE;
      i++;
      if (parse_int (parts[i], &cy2, err) == FALSE)
        return FALSE;
      /* end */
      i++;
      if (parse_int (parts[i], &x, err) == FALSE)
        return FALSE;
      i++;
      if (parse_int (parts[i], &y, err) == FALSE)
        return FALSE;

      if (rel) {
        cx1 = bbox.cx + cx1;
        cy1 = bbox.cy + cy1;
        cx2 = bbox.cx + cx2;
        cy2 = bbox.cy + cy2;
        x  = bbox.cx + x;
        y  = bbox.cy + y;
      }

#if 0
      struct fbbox fbox;
      /* TODO properly calculate minimal bbox using derivate */
      fbox = bbox_cubic_bezier (bbox.cx, bbox.cy, cx, cy, x, y);
      extend_bbox_by_frect (&bbox, &fbox);
#else
      extend_bbox_by_point (&bbox, x, y);
      extend_bbox_by_point (&bbox, cx1, cy1);
      extend_bbox_by_point (&bbox, cx2, cy2);
#endif
      bbox.cx = x;
      bbox.cy = y;
      break;
    }
    case 'Z':
      break;
    default:
      g_set_error (err, GM_ERROR, GM_ERROR_PARSING_FAILED, "Unknown command '%s'", cmd);
      return FALSE;
    }
  }

  *x1 = bbox.x1;
  *x2 = bbox.x2;
  *y1 = bbox.y1;
  *y2 = bbox.y2;
  return TRUE;
}
0707010000006A000081A40000000000000000000000016857C083000002EC000000000000000000000000000000000000002000000000gmobile-0.4.0/src/gm-svg-path.h/*
 * Copyright (C) 2022 The Phosh Developers
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#pragma once

#if !defined(_GMOBILE_INSIDE) && !defined(GMOBILE_COMPILATION)
#error "Only <gmobile.h> can be included directly."
#endif

#include <glib.h>

G_BEGIN_DECLS

gboolean               gm_svg_path_get_bounding_box (const char *path,
                                                     int        *x1,
                                                     int        *x2,
                                                     int        *y1,
                                                     int        *y2,
                                                     GError   **err);

G_END_DECLS
0707010000006B000081A40000000000000000000000016857C08300002013000000000000000000000000000000000000001F00000000gmobile-0.4.0/src/gm-timeout.c/*
 * Copyright (C) 2022 Purism SPC
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#include "gm-timeout.h"

#include <gio/gio.h>
#include <glib/gstdio.h>

#include <fcntl.h>
#include <unistd.h>
#include <sys/timerfd.h>

#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
/* https://github.com/jiixyj/epoll-shim/issues/45 */
#undef CLOCK_BOOTTIME
#define CLOCK_BOOTTIME CLOCK_MONOTONIC
#endif

typedef struct _GmTimeoutOnce {
  GSource  source;
  int      fd;
  gpointer tag;
  gulong   timeout_ms;
  gboolean armed;
} GmTimeoutOnce;


static gboolean
gm_timeout_once_prepare (GSource *source, gint *timeout)
{
  GmTimeoutOnce *timer = (GmTimeoutOnce *)source;
  struct itimerspec time_spec = { 0 };
  int ret;

  if (timer->fd == -1)
    return FALSE;

  if (timer->armed)
    return FALSE;

  time_spec.it_value.tv_sec = timer->timeout_ms / 1000;
  time_spec.it_value.tv_nsec = (timer->timeout_ms % 1000) * 1000;

  ret = timerfd_settime (timer->fd, 0 /* flags */, &time_spec, NULL);
  if (ret)
    g_warning ("Failed to set up timer: %s", strerror (ret));

  g_debug ("Prepared %p[%s] for %ld seconds",
	   source,
	   g_source_get_name (source)?: "(null)",
	   timer->timeout_ms / 1000);
  timer->armed = TRUE;
  /* Never wake up the source due to a timeout */
  *timeout = -1;
  return FALSE;
}


static gboolean
gm_timeout_once_dispatch (GSource     *source,
                          GSourceFunc  callback,
                          void        *data)
{
  if (!callback) {
    g_warning ("Timeout source dispatched without callback. "
               "You must call g_source_set_callback().");
    return G_SOURCE_REMOVE;
  }

  g_debug ("Dispatching %p[%s]", source, g_source_get_name (source)?: "(null)");
  callback (data);

  return G_SOURCE_REMOVE;
}


static void
gm_timeout_once_finalize (GSource *source)
{
  GmTimeoutOnce *timer = (GmTimeoutOnce *) source;

  g_clear_fd (&timer->fd, NULL);
  timer->armed = FALSE;

  if (timer->tag) {
    g_source_remove_unix_fd (source, timer->tag);
    timer->tag = NULL;
  }

  g_debug ("Finalize %p[%s]", source, g_source_get_name (source)?: "(null)");
}


static GSourceFuncs gm_timeout_once_source_funcs = {
  gm_timeout_once_prepare,
  NULL, /* check */
  gm_timeout_once_dispatch,
  gm_timeout_once_finalize,
};


static const char *
clockid_to_name (int clockid)
{
  switch (clockid) {
  case CLOCK_BOOTTIME:
    return "[gm] boottime timeout source";
  case CLOCK_BOOTTIME_ALARM:
    return "[gm] boottime wakeup timeout source";
  default:
    g_assert_not_reached();
    return "";
  }
}


static GSource *
gm_timeout_source_once_new (gulong timeout_ms, int clockid, GError **err)
{
  int fdf, fsf;
  GmTimeoutOnce *timer = NULL;

  timer = (GmTimeoutOnce *) g_source_new (&gm_timeout_once_source_funcs, sizeof (GmTimeoutOnce));
  timer->timeout_ms = timeout_ms;
  g_source_set_name ((GSource *)timer, clockid_to_name (clockid));
  timer->fd = timerfd_create (clockid, 0);
  if (timer->fd == -1) {
    int saved_errno = errno;
    g_set_error (err,
                 G_IO_ERROR,
                 g_io_error_from_errno (saved_errno),
                 "%s", g_strerror (saved_errno));
    g_source_unref ((GSource*)timer);
    return NULL;
  }

  fdf = fcntl (timer->fd, F_GETFD) | FD_CLOEXEC;
  fcntl (timer->fd, F_SETFD, fdf);
  fsf = fcntl (timer->fd, F_GETFL) | O_NONBLOCK;
  fcntl (timer->fd, F_SETFL, fsf);

  timer->tag = g_source_add_unix_fd (&timer->source, timer->fd, G_IO_IN | G_IO_ERR);
  return (GSource*)timer;
}


/**
 * gm_timeout_add_seconds_once_full: (rename-to gm_timeout_add_seconds_once)
 * @priority: the priority of the timeout source. Typically this will be in
 *   the range between %G_PRIORITY_DEFAULT and %G_PRIORITY_HIGH.
 * @seconds: the timeout in seconds
 * @function: function to call
 * @data: data to pass to @function
 * @notify: (nullable): function to call when the timeout is removed, or %NULL
 *
 * Sets a function to be called after a timeout with priority @priority.
 * Correctly calculates the timeout even when the system is suspended in between.
 *
 * This internally creates a main loop source using
 * g_timeout_source_new_seconds() and attaches it to the main loop context
 * using g_source_attach().
 *
 * The timeout given is in terms of `CLOCK_BOOTTIME` time, it hence is also
 * correct across suspend and resume. If that doesn't matter use
 * `g_timeout_add_seconds_full` instead.
 *
 * Note that glib's `g_timeout_add_seconds()` doesn't take system
 * suspend/resume into account: https://gitlab.gnome.org/GNOME/glib/-/issues/2739
 *
 * Changed in 0.3.0: Returns 0 when timer setup failed
 *
 * Returns: the ID (greater than 0) of the event source or 0 in case of error.
 *
 * Since: 0.0.1
 **/
guint
gm_timeout_add_seconds_once_full (gint            priority,
                                  gulong          seconds,
                                  GSourceOnceFunc function,
                                  gpointer        data,
                                  GDestroyNotify  notify)
{
  g_autoptr (GSource) source = NULL;
  guint id;

  g_return_val_if_fail (function != NULL, 0);

  source = gm_timeout_source_once_new (1000L * seconds, CLOCK_BOOTTIME, NULL);
  if (!source)
    return 0;

  if (priority != G_PRIORITY_DEFAULT)
    g_source_set_priority (source, priority);

  g_source_set_callback (source, (GSourceFunc)function, data, notify);
  id = g_source_attach (source, NULL);

  return id;
}

/**
 * gm_timeout_add_seconds_once:
 * @seconds: the timeout in seconds
 * @function: function to call
 * @data: data to pass to @function
 *
 * Sets a function to be called after a timeout with the default
 * priority, %G_PRIORITY_DEFAULT. Correctly calculates the timeout
 * even when the system is suspended in between.
 *
 * This internally creates a main loop source using
 * g_timeout_source_new_seconds() and attaches it to the main loop context
 * using g_source_attach().
 *
 * The timeout given is in terms of `CLOCK_BOOTTIME` time, it hence is also
 * correct across suspend and resume. If that doesn't matter use
 * `g_timeout_add_seconds` instead.
 *
 * Note that glib's `g_timeout_add_seconds()` doesn't take system
 * suspend/resume into account: https://gitlab.gnome.org/GNOME/glib/-/issues/2739
 *
 * Returns: the ID (greater than 0) of the event source.
 *
 * Since: 0.0.1
 **/
guint
gm_timeout_add_seconds_once (int             seconds,
                             GSourceOnceFunc function,
                             gpointer        data)
{
  g_return_val_if_fail (function != NULL, 0);

  return gm_timeout_add_seconds_once_full (G_PRIORITY_DEFAULT, seconds, function, data, NULL);
}


guint
gm_wakeup_timeout_add_seconds_once_full (gint            priority,
                                         gulong          seconds,
                                         GSourceOnceFunc function,
                                         gpointer        data,
                                         GDestroyNotify  notify,
                                         GError        **err)
{
  g_autoptr (GSource) source = NULL;
  guint id;

  g_return_val_if_fail (function != NULL, 0);

  source = gm_timeout_source_once_new (1000L * seconds, CLOCK_BOOTTIME_ALARM, err);
  if (!source)
    return 0;

  if (priority != G_PRIORITY_DEFAULT)
    g_source_set_priority (source, priority);

  g_source_set_callback (source, (GSourceFunc)function, data, notify);
  id = g_source_attach (source, NULL);

  return id;
}


guint
gm_wakeup_timeout_add_seconds_once (int             seconds,
                                    GSourceOnceFunc function,
                                    gpointer        data,
                                    GError        **err)
{
  g_return_val_if_fail (function != NULL, 0);

  return gm_wakeup_timeout_add_seconds_once_full (G_PRIORITY_DEFAULT,
                                                  seconds,
                                                  function,
                                                  data,
                                                  NULL,
                                                  err);
}
0707010000006C000081A40000000000000000000000016857C083000005A7000000000000000000000000000000000000001F00000000gmobile-0.4.0/src/gm-timeout.h/*
 * Copyright (C) 2022 Purism SPC
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#pragma once

#if !defined(_GMOBILE_INSIDE) && !defined(GMOBILE_COMPILATION)
#error "Only <gmobile.h> can be included directly."
#endif

#include <glib.h>

G_BEGIN_DECLS

guint       gm_timeout_add_seconds_once_full (int             priority,
					      gulong          seconds,
					      GSourceOnceFunc function,
					      gpointer        data,
					      GDestroyNotify  notify);
guint       gm_timeout_add_seconds_once      (int             seconds,
					      GSourceOnceFunc function,
					      gpointer        data);
guint       gm_wakeup_timeout_add_seconds_once_full (int             priority,
                                                     gulong          seconds,
                                                     GSourceOnceFunc function,
                                                     gpointer        data,
                                                     GDestroyNotify  notify,
                                                     GError        **err);
guint       gm_wakeup_timeout_add_seconds_once      (int             seconds,
                                                     GSourceOnceFunc function,
                                                     gpointer        data,
                                                     GError        **err);

G_END_DECLS
0707010000006D000081A40000000000000000000000016857C083000006BD000000000000000000000000000000000000001C00000000gmobile-0.4.0/src/gm-util.c/*
 * Copyright (C) 2023 The Phosh Developers
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#include "gm-resources.h"
#include "gm-util.h"

#include <glib.h>

/**
 * gm_str_is_null_or_empty:
 * @x:(nullable): A null terminated string
 *
 * Convenience macro to check if a given string is `NULL` or empty.
 * Evaluates to a truth value if `x` is `NULL` or `x` is the empty string
 * otherwise `FALSE`.
 *
 * Since: 0.0.5
 */

/**
 * gm_strv_is_null_or_empty:
 * @x:(nullable): A `NULL` terminated `GStrv`
 *
 * Convenience macro to check if a given `GStrv` is `NULL` or empty.
 * Evaluates to a truth value if `x` is `NULL` or `x` has no elements otherwise
 * `FALSE`.
 *
 * Since: 0.0.5
 */

/**
 * gm_list_devices:
 *
 * List device tree names of known devices.
 *
 * Returns:(nullable)(transfer full):The devices
 *
 * Since: 0.2.2
 */
GStrv
gm_list_devices (void)
{
  g_autoptr (GError) err = NULL;
  GResource *resource = gm_get_resource ();
  g_auto (GStrv) children = NULL;
  g_autoptr (GStrvBuilder) builder = g_strv_builder_new ();

  children = g_resource_enumerate_children (resource,
                                            "/org/gnome/gmobile/devices/display-panels/",
                                            G_RESOURCE_LOOKUP_FLAGS_NONE,
                                            &err);

   if (!children) {
     g_critical ("Failed to enumerate known devices: %s", err->message);
     return NULL;
   }

   for (int i = 0; children[i]; i++) {
     if (!g_str_has_suffix (children[i], ".json"))
       continue;

     g_strv_builder_take (builder, g_strndup (children[i], strlen(children[i]) - 5));
   }

   return g_strv_builder_end (builder);
}
0707010000006E000081A40000000000000000000000016857C083000001CA000000000000000000000000000000000000001C00000000gmobile-0.4.0/src/gm-util.h/*
 * Copyright (C) 2023 The Phosh Developers
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#pragma once

#if !defined(_GMOBILE_INSIDE) && !defined(GMOBILE_COMPILATION)
#error "Only <gmobile.h> can be included directly."
#endif

#define gm_str_is_null_or_empty(x) \
  ((x) == NULL || (x)[0] == '\0')
#define gm_strv_is_null_or_empty(x) \
  ((x) == NULL || (x)[0] == NULL)

GStrv gm_list_devices (void);
0707010000006F000081A40000000000000000000000016857C08300000264000000000000000000000000000000000000001C00000000gmobile-0.4.0/src/gmobile.h/*
 * Copyright (C) 2022 Purism SPC
 *               2022-2024 The Phosh Developers
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#pragma once

#ifndef GMOBILE_USE_UNSTABLE_API
#error    gmobile is unstable API. You must define GMOBILE_USE_UNSTABLE_API before including gmobile.h
#endif

#define _GMOBILE_INSIDE

#include "gm-config.h"
#include "gm-cutout.h"
#include "gm-device-info.h"
#include "gm-device-tree.h"
#include "gm-display-panel.h"
#include "gm-error.h"
#include "gm-main.h"
#include "gm-mcc-mnc.h"
#include "gm-timeout.h"
#include "gm-util.h"
07070100000070000081A40000000000000000000000016857C08300000929000000000000000000000000000000000000001E00000000gmobile-0.4.0/src/meson.buildgm_deps = [
  epoll_dep,
  gio_dep,
  glib_dep,
  json_glib_dep,
  cc.find_library('m', required: false),
  cc.find_library('rt', required: false),
]

gm_public_sources = files(
  'gm-cutout.c',
  'gm-device-info.c',
  'gm-device-tree.c',
  'gm-display-panel.c',
  'gm-error.c',
  'gm-main.c',
  'gm-mcc-mnc.c',
  'gm-rect.c',
  'gm-svg-path.c',
  'gm-timeout.c',
  'gm-util.c',
)

gm_public_headers = files(
  'gm-cutout.h',
  'gm-device-info.h',
  'gm-device-tree.h',
  'gm-display-panel.h',
  'gm-error.h',
  'gm-main.h',
  'gm-mcc-mnc.h',
  'gm-rect.h',
  'gm-svg-path.h',
  'gm-timeout.h',
  'gm-util.h',
  'gmobile.h',
)
install_headers(gm_public_headers + [gm_config_h], subdir: 'gmobile')

gm_sources = [gm_public_sources, gm_public_headers, gm_resources]

gm_c_args = ['-DG_LOG_DOMAIN="gmobile"']

gm_lib = both_libraries(
  'gmobile',
  gm_sources,
  include_directories: root_inc,
  c_args: gm_c_args,
  dependencies: gm_deps,
  soversion: '0',
  install: true,
)

gmobile_dep = declare_dependency(
  include_directories: [root_inc, include_directories('.')],
  dependencies: gm_deps,
  link_with: gm_lib.get_static_lib(),
)

gmobile_shared_dep = declare_dependency(
  include_directories: [root_inc, include_directories('.')],
  dependencies: gm_deps,
  link_with: gm_lib.get_shared_lib(),
)

pkgconfig = import('pkgconfig')
pkgconfig.generate(
  gm_lib,
  subdirs: 'gmobile',
  description: 'Functions useful in mobile related, glib based projects',
  url: 'https://world.pages.gitlab.gnome.org/Phosh/gmobile/',
)

if get_option('gtk_doc') or get_option('introspection')
  gmobile_gir_extra_args = [
    '--c-include=gmobile.h',
    '-L@0@'.format(meson.current_build_dir()),
    '--quiet',
    '-DGMOBILE_USE_UNSTABLE_API',
  ]

  gmobile_gir = gnome.generate_gir(
    gm_lib,
    sources: gm_public_sources + gm_public_headers,
    nsversion: '0',
    namespace: 'Gm',
    export_packages: 'gmobile',
    symbol_prefix: 'gm',
    identifier_prefix: 'Gm',
    includes: ['Gio-2.0'],
    install: get_option('introspection'),
    extra_args: gmobile_gir_extra_args,
  )

  if get_option('vapi')
    gmobile_vapi = gnome.generate_vapi(
      'gmobile',
      sources: gmobile_gir[0],
      packages: ['gio-2.0'],
      install: true,
      install_dir: vapidir,
      metadata_dirs: [meson.current_source_dir()],
    )
  endif
endif
07070100000071000041ED0000000000000000000000026857C08300000000000000000000000000000000000000000000001A00000000gmobile-0.4.0/subprojects07070100000072000081A40000000000000000000000016857C0830000009E000000000000000000000000000000000000002900000000gmobile-0.4.0/subprojects/gi-docgen.wrap[wrap-git]
directory=gi-docgen
url=https://gitlab.gnome.org/GNOME/gi-docgen.git
push-url=ssh://git@gitlab.gnome.org:GNOME/gi-docgen.git
revision=main
depth=1
07070100000073000081A40000000000000000000000016857C08300000067000000000000000000000000000000000000002900000000gmobile-0.4.0/subprojects/json-glib.wrap[wrap-git]
directory=json-glib
url=https://gitlab.gnome.org/GNOME/json-glib.git
revision=1.6.6
depth=1
07070100000074000041ED0000000000000000000000026857C08300000000000000000000000000000000000000000000001400000000gmobile-0.4.0/tests07070100000075000041ED0000000000000000000000026857C08300000000000000000000000000000000000000000000001900000000gmobile-0.4.0/tests/data07070100000076000041ED0000000000000000000000026857C08300000000000000000000000000000000000000000000002600000000gmobile-0.4.0/tests/data/compatibles107070100000077000041ED0000000000000000000000026857C08300000000000000000000000000000000000000000000002F00000000gmobile-0.4.0/tests/data/compatibles1/firmware07070100000078000041ED0000000000000000000000026857C08300000000000000000000000000000000000000000000003A00000000gmobile-0.4.0/tests/data/compatibles1/firmware/devicetree07070100000079000041ED0000000000000000000000026857C08300000000000000000000000000000000000000000000003F00000000gmobile-0.4.0/tests/data/compatibles1/firmware/devicetree/base0707010000007A000081A40000000000000000000000016857C0830000002B000000000000000000000000000000000000004A00000000gmobile-0.4.0/tests/data/compatibles1/firmware/devicetree/base/compatiblepurism,librem5r4purism,librem5fsl,imx8mq0707010000007B000041ED0000000000000000000000026857C08300000000000000000000000000000000000000000000002600000000gmobile-0.4.0/tests/data/compatibles20707010000007C000041ED0000000000000000000000026857C08300000000000000000000000000000000000000000000002F00000000gmobile-0.4.0/tests/data/compatibles2/firmware0707010000007D000041ED0000000000000000000000026857C08300000000000000000000000000000000000000000000003A00000000gmobile-0.4.0/tests/data/compatibles2/firmware/devicetree0707010000007E000041ED0000000000000000000000026857C08300000000000000000000000000000000000000000000003F00000000gmobile-0.4.0/tests/data/compatibles2/firmware/devicetree/base0707010000007F000081A40000000000000000000000016857C08300000000000000000000000000000000000000000000004A00000000gmobile-0.4.0/tests/data/compatibles2/firmware/devicetree/base/compatible07070100000080000081A40000000000000000000000016857C083000004D7000000000000000000000000000000000000002000000000gmobile-0.4.0/tests/meson.buildif get_option('tests')

  test_env = ['G_DEBUG=gc-friendly,fatal-warnings', 'MALLOC_CHECK_=2', 'NO_AT_BRIDGE=1']

  test_cflags = ['-DTEST_DATA_DIR="@0@"'.format(meson.current_source_dir() / 'data')]

  tests = ['cutout', 'display-panel', 'mcc-mnc', 'svg-path', 'timeout', 'utils', 'device-tree']
  # These need data not available on the installed system:
  not_installed = ['test-device-tree']

  foreach test : tests

    test_name = 'test-@0@'.format(test)
    test_conf = configuration_data()
    test_conf.set('installed_tests_dir', installed_tests_execdir)
    test_conf.set('program', test_name)
    test_conf.set('program', test_name)

    if get_option('installed_tests') and test_name not in not_installed
      configure_file(
        input: files('template.test.in'),
        output: test_name + '.test',
        install_dir: installed_tests_metadir,
        configuration: test_conf,
      )
    endif

    t = executable(
      test_name,
      ['test-@0@.c'.format(test)],
      c_args: test_cflags,
      pie: true,
      link_with: gm_lib,
      dependencies: gmobile_dep,
      install: get_option('installed_tests'),
      install_dir: installed_tests_execdir,
    )
    test(test, t, env: test_env)
  endforeach

endif
07070100000081000081A40000000000000000000000016857C08300000039000000000000000000000000000000000000002500000000gmobile-0.4.0/tests/template.test.in[Test]
Type=session
Exec=@installed_tests_dir@/@program@
07070100000082000081A40000000000000000000000016857C0830000037B000000000000000000000000000000000000002200000000gmobile-0.4.0/tests/test-cutout.c/*
 * Copyright (C) 2022 The Phosh Developers
 *
 * SPDX-License-Identifier: GPL-3-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#define GMOBILE_USE_UNSTABLE_API
#include "gmobile.h"


static void
test_gm_cutout_bounding_box (void)
{
  char *path = "M455, 0 \
                V 79    \
                H 625   \
                V 0     \
                Z";
  g_autoptr (GError) err = NULL;
  GmCutout *cutout;
  const GmRect *rect;

  cutout = gm_cutout_new (path);
  g_assert_no_error (err);

  rect = gm_cutout_get_bounds (cutout);
  g_assert_cmpint (rect->x, ==, 455);
  g_assert_cmpint (rect->y, ==, 0);
  g_assert_cmpint (rect->width, ==, 170);
  g_assert_cmpint (rect->height, ==, 79);
}


gint
main (gint argc, gchar *argv[])
{
  g_test_init (&argc, &argv, NULL);

  g_test_add_func ("/Gm/cutout/bounding-box", test_gm_cutout_bounding_box);

  return g_test_run ();
}
07070100000083000081A40000000000000000000000016857C083000005CD000000000000000000000000000000000000002700000000gmobile-0.4.0/tests/test-device-tree.c/*
 * Copyright (C) 2022 The Phosh Developers
 *
 * SPDX-License-Identifier: GPL-3-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#define GMOBILE_USE_UNSTABLE_API
#include "gmobile.h"

#include "gio/gio.h"

static void
test_gm_device_tree_get_compatibles (void)
{
  g_auto (GStrv) compatibles = NULL;
  GError *err = NULL;

  /* nonexistent */
  compatibles = gm_device_tree_get_compatibles (TEST_DATA_DIR "/doesnotexist", &err);
  g_assert_null (compatibles);
  g_assert_error (err, G_IO_ERROR, G_IO_ERROR_NOT_FOUND);
  g_clear_error (&err);

  /* nonexistent, don't store error */
  compatibles = gm_device_tree_get_compatibles (TEST_DATA_DIR "/doesnotexist", NULL);
  g_assert_null (compatibles);

  /* Regular format */
  compatibles = gm_device_tree_get_compatibles (TEST_DATA_DIR "/compatibles1", &err);
  g_assert_no_error (err);
  g_assert_nonnull (compatibles);
  g_assert_cmpstr (compatibles[0], ==, "purism,librem5r4");
  g_assert_cmpstr (compatibles[1], ==, "purism,librem5");
  g_assert_cmpstr (compatibles[2], ==, "fsl,imx8mq");
  g_assert_null (compatibles[3]);
  g_strfreev (compatibles);

  /* empty file */
  compatibles = gm_device_tree_get_compatibles (TEST_DATA_DIR "/compatibles2", &err);
  g_assert_no_error (err);
  g_assert_nonnull (compatibles);
}


gint
main (gint argc, gchar *argv[])
{
  g_test_init (&argc, &argv, NULL);

  g_test_add_func ("/Gm/device-tree/get-compatibles", test_gm_device_tree_get_compatibles);

  return g_test_run ();
}
07070100000084000081A40000000000000000000000016857C08300000977000000000000000000000000000000000000002900000000gmobile-0.4.0/tests/test-display-panel.c/*
 * Copyright (C) 2022 The Phosh Developers
 *
 * SPDX-License-Identifier: GPL-3-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#define GMOBILE_USE_UNSTABLE_API
#include "gmobile.h"


static void
test_gm_display_panel_parse (void)
{
  const char *json = "                                "
    "{                                                "
    " \"name\": \"Oneplus 6T\",                       "
    " \"x-res\": 1080,                                "
    " \"y-res\": 2340,                                "
    " \"border-radius\": 10,                          "
    " \"width\": 68,                                  "
    " \"height\": 145,                                "
    " \"cutouts\" : [                                 "
    "     {                                           "
    "        \"name\": \"notch\",                     "
    "        \"path\": \"M 455 0 V 79 H 625 V 0 Z\"   "
    "     }                                           "
    "  ]                                              "
    "}                                                ";
  g_autoptr (GError) err = NULL;
  g_autoptr (GmDisplayPanel) panel = NULL;
  g_autoptr (GmCutout) cutout = NULL;
  GListModel *cutouts;
  const GmRect *bounds;

  panel = gm_display_panel_new_from_data (json, &err);
  g_assert_no_error (err);
  g_assert_nonnull (panel);

  cutouts = gm_display_panel_get_cutouts (panel);
  g_assert_cmpint (g_list_model_get_n_items (cutouts), ==, 1);
  cutout = g_list_model_get_item (cutouts, 0);
  g_assert_nonnull (cutout);
  g_assert_cmpstr (gm_cutout_get_name (cutout), ==, "notch");
  g_assert_cmpstr (gm_cutout_get_path (cutout), ==, "M 455 0 V 79 H 625 V 0 Z");
  bounds = gm_cutout_get_bounds (cutout);
  g_assert_cmpint (bounds->x, ==, 455);
  g_assert_cmpint (bounds->y, ==, 0);
  g_assert_cmpint (bounds->width, ==, 170);
  g_assert_cmpint (bounds->height, ==, 79);

  g_assert_cmpint (gm_display_panel_get_x_res (panel), ==, 1080);
  g_assert_cmpint (gm_display_panel_get_y_res (panel), ==, 2340);

  g_assert_cmpint (gm_display_panel_get_border_radius (panel), ==, 10);

  g_assert_cmpint (gm_display_panel_get_width (panel), ==, 68);
  g_assert_cmpint (gm_display_panel_get_height (panel), ==, 145);
}


gint
main (gint argc, gchar *argv[])
{
  g_test_init (&argc, &argv, NULL);

  g_test_add_func ("/Gm/display-panel/parse", test_gm_display_panel_parse);

  return g_test_run ();
}
07070100000085000081A40000000000000000000000016857C08300000426000000000000000000000000000000000000002300000000gmobile-0.4.0/tests/test-mcc-mnc.c/*
 * Copyright (C) 2022 The Phosh Developers
 *
 * SPDX-License-Identifier: GPL-3-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#include "gio/gio.h"
#define GMOBILE_USE_UNSTABLE_API
#include "gmobile.h"


static void
test_country_code (void)
{
  const char *country_code;
  g_autoptr (GError) err = NULL;

  country_code = gm_mcc_to_iso ("228", &err);
  g_assert_no_error (err);
  g_assert_cmpstr (country_code, ==, "CH");

  country_code = gm_mcc_to_iso ("", &err);
  g_assert_null (country_code);
  g_assert_error (err, GM_ERROR, G_IO_ERROR_NOT_FOUND);

  g_clear_error (&err);
  country_code = gm_mcc_to_iso (NULL, &err);
  g_assert_null (country_code);
  g_assert_error (err, GM_ERROR, G_IO_ERROR_NOT_FOUND);

  g_clear_error (&err);
  country_code = gm_mcc_to_iso ("abc", &err);
  g_assert_null (country_code);
  g_assert_error (err, GM_ERROR, G_IO_ERROR_NOT_FOUND);
}


gint
main (gint argc, gchar *argv[])
{
  g_test_init (&argc, &argv, NULL);

  g_test_add_func ("/Gm/mcc-mnc/country-code", test_country_code);

  return g_test_run ();
}
07070100000086000081A40000000000000000000000016857C08300000D6D000000000000000000000000000000000000002400000000gmobile-0.4.0/tests/test-svg-path.c/*
 * Copyright (C) 2022 The Phosh Developers
 *
 * SPDX-License-Identifier: GPL-3-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#define GMOBILE_USE_UNSTABLE_API
#include "gm-svg-path.h"

#include "gio/gio.h"

static void
test_gm_svg_path_get_bounding_box_abs (void)
{
  const char *path = "M455, 0 \
     V 79    \
     H 625   \
     V 0     \
     Z ";
  gboolean success;
  int x1, x2, y1, y2;
  g_autoptr (GError) err = NULL;

  success = gm_svg_path_get_bounding_box (path, &x1, &x2, &y1, &y2, &err);
  g_assert_no_error (err);
  g_assert_true (success);

  g_assert_cmpint (x1, ==, 455);
  g_assert_cmpint (x2, ==, 625);
  g_assert_cmpint (y1, ==, 0);
  g_assert_cmpint (y2, ==, 79);
}


static void
test_gm_svg_path_get_bounding_box_rel (void)
{
  const char *path = "m 455 0 \
     v 79    \
     h 170   \
     v 0     \
     Z";
  gboolean success;
  int x1, x2, y1, y2;
  g_autoptr (GError) err = NULL;

  success = gm_svg_path_get_bounding_box (path, &x1, &x2, &y1, &y2, &err);
  g_assert_no_error (err);
  g_assert_true (success);

  g_assert_cmpint (x1, ==, 455);
  g_assert_cmpint (x2, ==, 625);
  g_assert_cmpint (y1, ==, 0);
  g_assert_cmpint (y2, ==, 79);
}


static void
test_gm_svg_path_get_bounding_box_arc (void)
{
  const char *path = "M 10 315\n"
                     "L 110 215\n"
                     "A 30 50 0 0 1 162 160";
  gboolean success;
  int x1, x2, y1, y2;
  g_autoptr (GError) err = NULL;

  success = gm_svg_path_get_bounding_box (path, &x1, &x2, &y1, &y2, &err);
  g_assert_no_error (err);
  g_assert_true (success);

  g_assert_cmpint (x1, ==, 10);
  g_assert_cmpint (x2, ==, 162);
  g_assert_cmpint (y1, ==, 136);
  g_assert_cmpint (y2, ==, 315);
}


static void
test_gm_svg_path_get_bounding_box_quad_bezier (void)
{
  /* control point not between start and end */
  const char *path1 = "M 70 250 Q 20 110 220 60 Z";
  /* same but in relative */
  const char *path1_rel = "M 70 250 q -50 -140 150 -190 Z";
  /* control point between start and end */
  const char *path2 = "M 70 250 Q 110 110 220 60 Z";
  gboolean success;
  int x1, x2, y1, y2;
  g_autoptr (GError) err = NULL;

  success = gm_svg_path_get_bounding_box (path1, &x1, &x2, &y1, &y2, &err);
  g_assert_no_error (err);
  g_assert_true (success);

  g_assert_cmpint (x1, ==, 60);
  g_assert_cmpint (x2, ==, 220);
  g_assert_cmpint (y1, ==, 60);
  g_assert_cmpint (y2, ==, 250);

  success = gm_svg_path_get_bounding_box (path1_rel, &x1, &x2, &y1, &y2, &err);
  g_assert_no_error (err);
  g_assert_true (success);

  g_assert_cmpint (x1, ==, 60);
  g_assert_cmpint (x2, ==, 220);
  g_assert_cmpint (y1, ==, 60);
  g_assert_cmpint (y2, ==, 250);

  success = gm_svg_path_get_bounding_box (path2, &x1, &x2, &y1, &y2, &err);
  g_assert_no_error (err);
  g_assert_true (success);

  g_assert_cmpint (x1, ==, 70);
  g_assert_cmpint (x2, ==, 220);
  g_assert_cmpint (y1, ==, 60);
  g_assert_cmpint (y2, ==, 250);
}


gint
main (gint argc, gchar *argv[])
{
  g_test_init (&argc, &argv, NULL);

  g_test_add_func ("/Gm/svg-path/bounding_box/abs", test_gm_svg_path_get_bounding_box_abs);
  g_test_add_func ("/Gm/svg-path/bounding_box/rel", test_gm_svg_path_get_bounding_box_rel);
  g_test_add_func ("/Gm/svg-path/bounding_box/arc", test_gm_svg_path_get_bounding_box_arc);
  g_test_add_func ("/Gm/svg-path/bounding_box/quad_bezier",
                   test_gm_svg_path_get_bounding_box_quad_bezier);

  return g_test_run ();
}
07070100000087000081A40000000000000000000000016857C083000005C6000000000000000000000000000000000000002300000000gmobile-0.4.0/tests/test-timeout.c/*
 * Copyright (C) 2022 Purism SPC
 *
 * SPDX-License-Identifier: GPL-3-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#define GMOBILE_USE_UNSTABLE_API
#include "gmobile.h"


static void
on_timeout (gpointer data)
{
  g_main_loop_quit (data);
}


static void
test_gm_timeout_simple (void)
{
  g_autoptr (GMainLoop) loop = NULL;
  int seconds = 1;

  loop = g_main_loop_new (NULL, FALSE);
  gm_timeout_add_seconds_once (seconds, on_timeout, loop);
  g_main_loop_run (loop);
}


static void
on_timeout2 (gpointer data)
{
  g_assert_not_reached ();
}


static gboolean
remove_timeout (gpointer data)
{
  g_source_remove (GPOINTER_TO_UINT (data));

  return G_SOURCE_REMOVE;
}


static void
test_gm_timeout_remove (void)
{
  g_autoptr (GMainLoop) loop = NULL;
  guint id;

  loop = g_main_loop_new (NULL, FALSE);
  id = gm_timeout_add_seconds_once (1, on_timeout2, NULL);
  g_assert_nonnull (g_main_context_find_source_by_id (NULL, id));
  g_idle_add (remove_timeout, GUINT_TO_POINTER (id));
  /* End the main loop, id must not have fired yet */
  g_timeout_add_seconds (2, (GSourceFunc)on_timeout, loop);
  g_main_loop_run (loop);
  /* source got removed */
  g_assert_null (g_main_context_find_source_by_id (NULL, id));
}


gint
main (gint argc,
      gchar *argv[])
{
  g_test_init (&argc, &argv, NULL);

  g_test_add_func ("/Gm/timeout/simple", test_gm_timeout_simple);
  g_test_add_func ("/Gm/timeout/remove", test_gm_timeout_remove);

  return g_test_run ();
}
07070100000088000081A40000000000000000000000016857C0830000065D000000000000000000000000000000000000002100000000gmobile-0.4.0/tests/test-utils.c/*
 * Copyright (C) 2022-2024 The Phosh Developers
 *
 * SPDX-License-Identifier: GPL-3-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#define GMOBILE_USE_UNSTABLE_API
#include "gmobile.h"


static void
test_gm_str_is_null_or_empty (void)
{
  g_assert_true (gm_str_is_null_or_empty ((char *)NULL));
  g_assert_true (gm_str_is_null_or_empty (""));
  g_assert_false (gm_str_is_null_or_empty ("notempty"));
}


static void
test_gm_strv_is_null_or_empty (void)
{
  const char * const *not_empty = (const char *const []) {"still", "not", "empty", NULL };

  g_assert_true (gm_strv_is_null_or_empty ((char **)NULL));
  g_assert_true (gm_strv_is_null_or_empty ((char *[]){NULL}));
  g_assert_false (gm_strv_is_null_or_empty (((char *[]){"notempty", NULL,})));
  g_assert_cmpint (g_strv_length ((GStrv)not_empty), ==, 3);
  /* Check that we don't hit any compiler warnings */
  g_assert_false (gm_strv_is_null_or_empty (not_empty));
  g_assert_false (gm_strv_is_null_or_empty ((GStrv)not_empty));
}


static void
test_gm_list_devices (void)
{
  GStrv devices = gm_list_devices ();

  for (int i = 0; devices[i]; i++)
    g_message ("Device: '%s'", devices[i]);

  g_assert_true (g_strv_contains ((const char * const *)devices, "purism,librem5"));

  g_strfreev (devices);
}


gint main (gint argc, gchar *argv[])
{
  g_test_init (&argc, &argv, NULL);

  gm_init ();

  g_test_add_func ("/Gm/util/str_null_or_empty", test_gm_str_is_null_or_empty);
  g_test_add_func ("/Gm/util/strv_null_or_empty", test_gm_strv_is_null_or_empty);
  g_test_add_func ("/Gm/util/list_devices", test_gm_list_devices);

  return g_test_run ();
}
07070100000089000041ED0000000000000000000000026857C08300000000000000000000000000000000000000000000001400000000gmobile-0.4.0/tools0707010000008A000081ED0000000000000000000000016857C08300000106000000000000000000000000000000000000001F00000000gmobile-0.4.0/tools/render-all#!/bin/bash

set -e

OUT=_build/out/
DTS=$(sed -n -e 's,.*devices/display-panels/\([a-z0-9,]\+\).json<.*,\1,p' data/gmobile.gresources.xml)

mkdir -p "${OUT}"
for DT in ${DTS}; do
  _build/examples/gm-display-panel-preview -c "${DT}" -o "${OUT}/${DT}.html"
done
07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!505 blocks
openSUSE Build Service is sponsored by