gf-logical-monitor-private.h 4.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/*
 * Copyright (C) 2016 Red Hat
 * Copyright (C) 2017 Alberts Muktupāvels
 *
 * 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/>.
 *
 * Adapted from mutter:
 * - src/backends/meta-logical-monitor.h
 */

#ifndef GF_LOGICAL_MONITOR_PRIVATE_H
#define GF_LOGICAL_MONITOR_PRIVATE_H

25
#include "gf-direction.h"
26
#include "gf-logical-monitor-config-private.h"
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
#include "gf-monitor-config-manager-private.h"
#include "gf-monitor-manager-private.h"
#include "gf-monitor-private.h"

G_BEGIN_DECLS

#define GF_TYPE_LOGICAL_MONITOR (gf_logical_monitor_get_type ())
G_DECLARE_FINAL_TYPE (GfLogicalMonitor, gf_logical_monitor,
                      GF, LOGICAL_MONITOR, GObject)

struct _GfLogicalMonitor
{
  GObject             parent;

  gint                number;
  GfRectangle         rect;
  gboolean            is_primary;
  gboolean            is_presentation;
  gboolean            in_fullscreen;
  gfloat              scale;
  GfMonitorTransform  transform;

  /* The primary or first output for this monitor, 0 if we can't figure out.
   * It can be matched to a winsys_id of a GfOutput.
   *
   * This is used as an opaque token on reconfiguration when switching from
   * clone to extened, to decide on what output the windows should go next
   * (it's an attempt to keep windows on the same monitor, and preferably on
   * the primary one).
   */
  glong               winsys_id;

  GList              *monitors;
};

62 63 64 65 66
typedef void (* GfLogicalMonitorCrtcFunc) (GfLogicalMonitor *logical_monitor,
                                           GfCrtc           *crtc,
                                           gpointer          user_data);


67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
GfLogicalMonitor   *gf_logical_monitor_new           (GfMonitorManager       *monitor_manager,
                                                      GfLogicalMonitorConfig *logical_monitor_config,
                                                      gint                    monitor_number);

GfLogicalMonitor   *gf_logical_monitor_new_derived   (GfMonitorManager       *monitor_manager,
                                                      GfMonitor              *monitor,
                                                      GfRectangle            *layout,
                                                      gfloat                  scale,
                                                      gint                    monitor_number);

void                gf_logical_monitor_add_monitor   (GfLogicalMonitor       *logical_monitor,
                                                      GfMonitor              *monitor);

gboolean            gf_logical_monitor_is_primary    (GfLogicalMonitor       *logical_monitor);

void                gf_logical_monitor_make_primary  (GfLogicalMonitor       *logical_monitor);

gfloat              gf_logical_monitor_get_scale     (GfLogicalMonitor       *logical_monitor);

GfMonitorTransform  gf_logical_monitor_get_transform (GfLogicalMonitor       *logical_monitor);

GfRectangle         gf_logical_monitor_get_layout    (GfLogicalMonitor       *logical_monitor);

GList              *gf_logical_monitor_get_monitors  (GfLogicalMonitor       *logical_monitor);

92 93 94 95
gboolean            gf_logical_monitor_has_neighbor  (GfLogicalMonitor       *monitor,
                                                      GfLogicalMonitor       *neighbor,
                                                      GfDirection             direction);

96 97 98 99 100
void                gf_logical_monitor_foreach_crtc  (GfLogicalMonitor         *logical_monitor,
                                                      GfLogicalMonitorCrtcFunc  func,
                                                      gpointer                  user_data);


101 102 103
G_END_DECLS

#endif