ege-color-prof-tracker.cpp revision 65ad200c98b082f9ec02ce216f0a8fc146ac1bab
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is EGE Color Profile Tracker.
*
* The Initial Developer of the Original Code is
* Jon A. Cruz.
* Portions created by the Initial Developer are Copyright (C) 2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* Note: this file should be kept compilable as both .cpp and .c */
#include <string.h>
#ifdef GDK_WINDOWING_X11
#endif /* GDK_WINDOWING_X11 */
#include "ege-color-prof-tracker.h"
#include "helper/sp-marshal.h"
/*
#define GDK_ROOT_WINDOW() (gdk_x11_get_default_root_xwindow ())
#define GDK_DISPLAY() gdk_display
#define GDK_WINDOW_XDISPLAY(win)
#define GDK_WINDOW_XID(win)
#define GDK_DISPLAY_XDISPLAY(display)
#define GDK_SCREEN_XDISPLAY(screen)
#define GDK_SCREEN_XNUMBER(screen)
#define GDK_SCREEN_XSCREEN(screen)
#define GDK_WINDOW_XWINDOW
#define GDK_DRAWABLE_XID(win)
GdkWindow* gdk_window_lookup (GdkNativeWindow anid);
GdkWindow* gdk_window_lookup_for_display (GdkDisplay *display,
GdkNativeWindow anid);
GdkDisplay* gdk_x11_lookup_xdisplay (Display *xdisplay);
Display* gdk_x11_display_get_xdisplay (GdkDisplay *display);
Window gdk_x11_get_default_root_xwindow (void);
gint gdk_x11_get_default_screen (void);
Display* gdk_x11_get_default_xdisplay (void);
int gdk_x11_screen_get_screen_number (GdkScreen *screen);
Screen* gdk_x11_screen_get_xscreen (GdkScreen *screen);
const gchar* gdk_x11_get_xatom_name (Atom xatom);
const gchar* gdk_x11_get_xatom_name_for_display (GdkDisplay *display,
Atom xatom);
*/
enum {
CHANGED = 0,
static void ege_color_prof_tracker_get_property( GObject* obj, guint propId, GValue* value, GParamSpec * pspec );
static void ege_color_prof_tracker_set_property( GObject* obj, guint propId, const GValue *value, GParamSpec* pspec );
typedef struct _ScreenTrack {
#ifdef GDK_WINDOWING_X11
#endif /* GDK_WINDOWING_X11 */
} ScreenTrack;
#ifdef GDK_WINDOWING_X11
#endif /* GDK_WINDOWING_X11 */
static GObjectClass* gParentClass = 0;
static GSList* tracked_screens = 0;
static GSList* abstract_trackers = 0;
struct _EgeColorProfTrackerPrivate
{
};
#define EGE_GET_PRIVATE( o ) ( G_TYPE_INSTANCE_GET_PRIVATE( (o), EGE_COLOR_PROF_TRACKER_TYPE, EgeColorProfTrackerPrivate ) )
static void target_hierarchy_changed_cb(GtkWidget* widget, GtkWidget* prev_top, gpointer user_data);
static void target_screen_changed_cb(GtkWidget* widget, GdkScreen* prev_screen, gpointer user_data);
GType ege_color_prof_tracker_get_type( void )
{
if ( !myType ) {
sizeof( EgeColorProfTrackerClass ),
NULL, /* base_init */
NULL, /* base_finalize */
NULL, /* class_finalize */
NULL, /* class_data */
sizeof( EgeColorProfTracker ),
0, /* n_preallocs */
};
}
return myType;
}
{
if ( klass ) {
G_TYPE_NONE, 0 );
0,
G_TYPE_NONE, 2,
0,
G_TYPE_NONE, 2,
0,
G_TYPE_NONE, 2,
}
}
{
}
{
NULL );
if ( target ) {
g_signal_connect( G_OBJECT(target), "hierarchy-changed", G_CALLBACK( target_hierarchy_changed_cb ), obj );
g_signal_connect( G_OBJECT(target), "screen-changed", G_CALLBACK( target_screen_changed_cb ), obj );
/* invoke the callbacks now to connect if the widget is already visible */
} else {
while ( curr ) {
}
}
}
return tracker;
}
void ege_color_prof_tracker_get_profile( EgeColorProfTracker const * tracker, gpointer* ptr, guint* len )
{
while ( curr ) {
if ( tracker->private_data->_monitor >= 0 && tracker->private_data->_monitor < (gint)screenTrack->profiles->len ) {
GByteArray* gba = (GByteArray*)g_ptr_array_index( screenTrack->profiles, tracker->private_data->_monitor );
if ( gba ) {
}
} else {
g_warning("No profile data tracked for the specified item.");
}
break;
}
}
}
if ( ptr ) {
}
if ( len ) {
}
}
void ege_color_prof_tracker_get_profile_for( guint screenNum, guint monitor, gpointer* ptr, guint* len )
{
GdkScreen* screen = (screenNum < (guint)numScreens) ? gdk_display_get_screen(display, screenNum) : 0;
if ( screen ) {
while ( curr ) {
if ( gba ) {
}
} else {
g_warning("No profile data tracked for the specified item.");
}
break;
}
}
}
if ( ptr ) {
}
if ( len ) {
}
}
void ege_color_prof_tracker_get_property( GObject* obj, guint propId, GValue* value, GParamSpec * pspec )
{
(void)tracker;
(void)value;
switch ( propId ) {
default:
}
}
void ege_color_prof_tracker_set_property( GObject* obj, guint propId, const GValue *value, GParamSpec* pspec )
{
(void)tracker;
(void)value;
switch ( propId ) {
default:
}
}
{
/* First remove the tracker from different screens */
while ( curr ) {
}
}
}
if ( curr ) {
/* We found the screen already being tracked */
if ( !trackHook ) {
}
} else {
int i = 0;
#ifdef GDK_WINDOWING_X11
#endif /* GDK_WINDOWING_X11 */
for ( i = 0; i < numMonitors; i++ ) {
}
g_signal_connect( G_OBJECT(screen), "size-changed", G_CALLBACK( screen_size_changed_cb ), tracker );
#ifdef GDK_WINDOWING_X11
#endif // GDK_WINDOWING_X11
}
}
{
(void)data;
while ( curr ) {
while ( trackHook ) {
if ( (void*)(((EgeColorProfTracker*)(trackHook->data))->private_data->_target) == (void*)where_the_object_was ) {
/* The tracked widget is now gone, remove it */
trackHook = 0;
} else {
}
}
}
}
{
(void)data;
(void)where_the_object_was;
/* g_message("Window at %p is now going away", where_the_object_was); */
}
{
}
}
}
{
if ( gtk_widget_is_toplevel(top) ) {
}
}
}
{
}
}
{
(void)user_data;
/* g_message("screen size changed to (%d, %d) with %d monitors for obj:%p", */
/* gdk_screen_get_width(screen), gdk_screen_get_height(screen), */
/* gdk_screen_get_n_monitors(screen), */
/* user_data); */
}
if ( curr ) {
guint i = 0;
#ifdef GDK_WINDOWING_X11
{
}
#endif /* GDK_WINDOWING_X11 */
}
/* g_message("The count of monitors decreased, remove some"); */
}
}
}
{
while ( curr ) {
while ( trackHook ) {
}
}
}
}
}
{
}
if ( curr ) {
guint i = 0;
GByteArray* previous = 0;
}
if ( previous ) {
}
}
}
{
}
if ( curr ) {
/* Something happened to a screen being tracked. */
guint i = 0;
GByteArray* previous = 0;
}
if ( previous ) {
}
} else {
}
}
}
}
#ifdef GDK_WINDOWING_X11
{
(void)event;
(void)data;
/*GdkAtom gatom = gdk_x11_xatom_to_atom(note->atom);*/
if ( stat ) {
if ( display ) {
GdkScreen* targetScreen = 0;
gint i = 0;
for ( i = 0; i < screenCount; i++ ) {
targetScreen = sc;
}
}
}
} else {
/* g_message("%d failed XGetWindowAttributes with %d", GPOINTER_TO_INT(data), stat); */
}
}
}
return GDK_FILTER_CONTINUE;
}
{
}
}
int actualFormat = 0;
unsigned long nitems = 0;
unsigned long bytesAfter = 0;
unsigned char* prop = 0;
bytesAfter = 0;
nitems = 0;
if ( prop ) {
prop = 0;
}
} else {
g_warning("Problem reading profile from root window");
}
} else {
/* clear it */
}
} else {
g_warning("error loading profile property");
}
}
}
{
if ( root ) {
int numWinProps = 0;
gint i;
gdk_window_set_events(root, (GdkEventMask)(gdk_window_get_events(root) | GDK_PROPERTY_CHANGE_MASK));
/* Look for any profiles attached to this root window */
if ( propArray ) {
int j = 0;
for ( i = 0; i < numWinProps; i++ ) {
}
}
} else {
/* g_message("Base atom not found"); */
}
for ( i = 1; i < numMonitors; i++ ) {
for ( j = 0; j < numWinProps; j++ ) {
}
}
}
}
propArray = 0;
}
}
}
#endif /* GDK_WINDOWING_X11 */