Commit Graph

88 Commits

Author SHA1 Message Date
Benjamin Otte
f7608c33ac gdk: Move scratch GC handling to X11
... and implement it directly instead of using GdkGC, as GdkGC is about
to be deleted, but we need this code.
2010-08-10 21:02:29 +02:00
Benjamin Otte
9c026fb32e x11: Remove unused code
These are function definitions and leftover variabl;es that weren't in
use for a while.
2010-08-10 21:02:29 +02:00
Javier Jardón
404e7d0e00 gdk/: fully remove gdkalias hacks
https://bugzilla.gnome.org/show_bug.cgi?id=623845
2010-07-10 02:21:31 +02:00
Matthias Clasen
b96a05b81f Silence a few warnings in !HAVE_RANDR builds 2010-06-03 20:24:54 -04:00
Matthias Clasen
bd4609b140 Merge the xi2-for-master branch 2010-05-25 18:38:44 -04:00
Florian Scandella
53fae3247c Add heuristic for primary monitor
Use the first monitor returned by RANDR as primary, if primary
is not set and no LVDS is found.

https://bugzilla.gnome.org/show_bug.cgi?id=615128
2010-04-23 23:42:02 +02:00
Matthias Clasen
b4adea7477 Fix a silly mistake in primary_monitor handling
It doesn't make sense to determine an index into an array, if
you are going to sort the array afterwards...pointed out in
bug 615128 by Florian Scandella.
2010-04-09 09:05:38 -04:00
Adel Gadllah
20dacce4d8 [GdkScreenX11] Fix check in gdk_screen_get_primary_monitor
Fix bug in last commit.
2010-04-06 02:41:55 +02:00
Adel Gadllah
5651cbc4b4 [GdkScreenX11] Add heuristic for pre XRandR 1.3 drivers
Currently gdk_screen_get_primary_monitor just returns the first monitor,
in this case but both the panel and now gnome-shell use an additional
heuristic to prefer LVDS as primary if present.

Move this heuristic to gdk_screen_get_primary_monitor to avoid duplicating
it all over the place.

The fallback heuristic is also used when no primary output is set.

https://bugzilla.gnome.org/show_bug.cgi?id=614894
2010-04-06 02:36:53 +02:00
Matthias Clasen
bcee7bda64 Add some missing introspection annotations 2010-02-22 23:47:24 -05:00
Matthias Clasen
c85e7ec6d8 Add a missing introspection annotation for gdk_screen_get_default_colormap 2010-02-22 14:15:45 -05:00
Colin Walters
18dc96caf8 Merge in Gdk-custom.c introspection annotations
The Gdk-custom.c file in gir-repository contained a number of
introspection annotations.  Merge those into the GDK source files.

Some documentation was moved from the tmpl/ files to accomodate
the addition of annotations.

https://bugzilla.gnome.org/show_bug.cgi?id=592279
2009-12-16 17:22:01 -02:00
Cody Russell
662e69ad3e Add gdk_screen_get_primary_monitor(). This fixes bug #601712 2009-12-08 11:27:02 -06:00
Matthias Clasen
43a07af9b1 Be a bit more forgiving about invalid monitor number
By moving the g_return_if_fail() checks into individual monitor functions.
See bug 561130.
2009-11-27 18:39:15 -05:00
Michael Meeks
02b102cbbc fix whitespace error 2009-09-14 15:34:43 +01:00
Michael Meeks
db88f084bc fix race between fetching owner of composit selection, and
registering as a listener for changes; bug#594913
2009-09-14 15:33:59 +01:00
Matthias Clasen
f649237bf2 Minor doc fix 2009-08-31 00:55:57 -04:00
Javier Jardón
ec7c24d227 Remove some unused variables (GnomeBug:591218) 2009-08-10 11:06:54 +02:00
Caolan McNamara
5964109ef3 Plug a memory leak in Xrandr code 2009-05-30 00:05:35 -04:00
Carlos Garcia Campos
5261d14d6f Fix memory leak in gdkscreen-x11
When RandR 1.2 X driver doesn't return any usable multihead data the
monitors array is freed, without freeing the memory allocated by the array
elements before. Fixes bug #578354
2009-04-10 00:14:23 -04:00
Matthias Clasen
fcdd092ae6 Another attempt at getting Xrandr screen size changes right. Actually
* gdk/x11/gdkevents-x11.c:
        * gdk/x11/gdkscreen-x11.[hc]: Another attempt at getting Xrandr
        screen size changes right. Actually handle XRRScreenChangeNotify
        events, and ignore root ConfigureNotify events if we are using
        Xrandr. Only emit size-changed signals if the screen size changed,
        and only emit monitor-changed signals if the monitors changed.


svn path=/trunk/; revision=22398
2009-02-24 05:09:13 +00:00
Ray Strode
e822462333 After using randr to get a list of monitors, sort the list such that the
2009-02-19  Ray Strode  <rstrode@redhat.com>

	* gdk/x11/gdkscreen-x11.c
	(monitor_compare_function), (init_randr13):
	After using randr to get a list of monitors,
	sort the list such that the biggest output
	of "cloned" outputs comes first in the list.
	This helps apps that don't generally handle
	overlapping outputs to work better in randr
	clone mode.

svn path=/trunk/; revision=22386
2009-02-20 04:42:33 +00:00
Matthias Clasen
0bd95af21a Be more robust against X breakage
svn path=/trunk/; revision=22378
2009-02-19 19:13:10 +00:00
Matthias Clasen
f517b9d5fc some xrandr fixes
svn path=/trunk/; revision=22370
2009-02-18 23:12:26 +00:00
Matthias Clasen
2e67143e3b Check for Xrandr 1.3
* configure.in: Check for Xrandr 1.3

        * gdk/x11/gdkdisplay-x11.[ch]: Rename have_randr12 to have_randr13
        and set if if we have randr 1.3

        * gdk/x11/gdkscreen-x11.c: Go back to using randr for monitor
        information, if we have XRRGetScreenResourcesCurrent.


svn path=/trunk/; revision=22327
2009-02-13 18:12:57 +00:00
Matthias Clasen
aadac20e90 Only emit size-changed if the screen size actually changed.
2008-10-22  Matthias Clasen  <mclasen@redhat.com>

        * gdk/x11/gdkscreen-x11.c: Only emit size-changed if the screen
        size actually changed.


svn path=/trunk/; revision=21698
2008-10-22 14:55:56 +00:00
Søren Sandmann
90759964ee Don't use XRRGetScreenResources() as there are performance issues with it.
Wed Sep 10 06:18:25 2008  Søren Sandmann  <sandmann@redhat.com>

	* gdk/x11/gdkscreen-x11.c (init_multihead): Don't use
	XRRGetScreenResources() as there are performance issues with
	it. Instead rely on the fact that the RandR information is
	propagated through Xinerama as well.


svn path=/trunk/; revision=21334
2008-09-10 10:22:25 +00:00
Søren Sandmann Pedersen
779bd67a29 +Wed Aug 20 18:16:29 2008 Søren Sandmann <sandmann@redhat.com>
+
+	* gdk/x11/gdkscreen-x11.c (_gdk_x11_screen_size_changed): Emit the
+	monitors changed signal when the screen size changes.
+


svn path=/trunk/; revision=21172
2008-08-20 22:18:38 +00:00
Erwann Chenede -
a82a25aa23 Bug 547456 - gdk/x11/gdkscreen-x11.c : init_solaris_xinerama doesn't
2008-08-13 Erwann Chenede - <erwann.chenede@sun.com>

  Bug 547456 - gdk/x11/gdkscreen-x11.c : init_solaris_xinerama 
  doesn't compile on Solaris

  * gdk/x11/gdkscreen-x11.c: make init_solaris_xinerama () compile 
  when HAVE_SOLARIS_XINERAMA is defined.



svn path=/trunk/; revision=21107
2008-08-13 13:47:02 +00:00
Frederic Crozat
db7915ec51 Don't use RandR 1.2 if driver is detected as randr12_compat (ie X driver
2008-07-22  Frederic Crozat  <fcrozat@mandriva.com>

        * gdk/x11/gdkscreen-x11.c: Don't use RandR 1.2
        if driver is detected as randr12_compat (ie X driver
        is not RandR 1.2 compliant). Fixes multihead with
        such drivers. Bug #543317.


svn path=/trunk/; revision=20893
2008-07-22 17:41:39 +00:00
Matthias Clasen
486d65659f Bug 493008 – gdk_screen_get_window_stack is not 64-bit-compatible
2008-07-06  Matthias Clasen  <mclasen@redhat.com>

        Bug 493008 – gdk_screen_get_window_stack is not 64-bit-compatible

        * gdk/x11/gdkscreen-x11.c (gdk_screen_get_window_stack): Fix
        64-bit brokenness. Reported by Christian Hammond.


svn path=/trunk/; revision=20788
2008-07-06 06:05:02 +00:00
Johan Dahlin
d97cdbdf53 Include "config.h" instead of <config.h> Command used: find -name
2008-06-21  Johan Dahlin  <jdahlin@async.com.br>

    * *.[ch]: Include "config.h" instead of <config.h>
    Command used:
    find -name \*.[ch]|xargs perl -p -i -e 's/^#include <config.h>/#include "config.h"/g'
    Rubberstamped by Mitch and Tim


svn path=/trunk/; revision=20669
2008-06-22 14:28:52 +00:00
Matthias Clasen
a8d1c9808c Documentation fixes
svn path=/trunk/; revision=19577
2008-02-15 18:37:34 +00:00
Christian Persch
82568d02e0 Fir the patch from bug #504886 not to read unitialised memory.
2007-12-27  Christian Persch  <chpe@gnome.org>

	* gdk/x11/gdkscreen-x11.c: (init_randr12): Fir the patch from 
	bug #504886 not to read unitialised memory.

svn path=/trunk/; revision=19247
2007-12-27 12:09:06 +00:00
Christian Persch
102db3cc7d Plug mem leaks. Bug #504886.
2007-12-22  Christian Persch  <chpe@gnome.org>

	* gdk/x11/gdkscreen-x11.c: (init_randr12): Plug mem leaks. Bug #504886.

svn path=/trunk/; revision=19223
2007-12-22 21:03:40 +00:00
Søren Sandmann
053cbe6daf Add RandR 1.2 support
Thu Dec 13 13:14:50 2007  Søren Sandmann  <sandmann@redhat.com>

        * Add RandR 1.2 support

        - New monitors_changed signal - New API to get width/height of
          monitors, and the name of the plug



svn path=/trunk/; revision=19173
2007-12-13 18:27:05 +00:00
Tor Lillqvist
b18f044270 Add functionality to set overall opacity of a top-level window. (#405316)
2007-04-30  Tor Lillqvist  <tml@novell.com>

	Add functionality to set overall opacity of a top-level
	window. (#405316)

	* gdk/gdk.symbols: Add gdk_window_set_opacity.

	* gdk/x11/gdkwindow-x11.c
	* gdk/win32/gdkwindow-win32.c: Implement
	gdk_window_set_opacity(). On X11 use the _NET_WM_WINDOW_OPACITY
	property. On Win32 use SetLayeredWindowAttributes(LWA_ALPHA).

	* gdk/gdkwindow.h: Declare gdk_window_set_opacity().

	* gdk/x11/gdkscreen-x11.c (gdk_screen_get_rgba_colormap): Document
	that this is not implemented in the Windows backend. Add reference
	to gdk_window_set_opacity().


svn path=/trunk/; revision=17730
2007-04-30 07:27:22 +00:00
Loïc Minier
8b20a27e0a Revert to non-xinerama mode when XineramaQueryScreens returns NULL; patch
2007-04-03  Loïc Minier  <lool@dooz.org>

	* gdk/x11/gdkscreen-x11.c: (check_xfree_xinerama): Revert to
	non-xinerama mode when XineramaQueryScreens returns NULL; patch from
	Simon McVittie; #425786.

svn path=/trunk/; revision=17579
2007-04-03 13:48:26 +00:00
Matthias Clasen
82ce59cd0f Remove unnecessary NULL checks before g_free(). (#369666, Morten Welinder,
2007-03-09  Matthias Clasen <mclasen@redhat.com>

        * Everywhere: Remove unnecessary NULL checks before
        g_free().  (#369666, Morten Welinder, Djihed Afifi)

        * configure.in: Check for ftw.h



svn path=/trunk/; revision=17444
2007-03-09 21:57:37 +00:00
Matthias Clasen
4c01fbf79c Remove _gdk_x11_screen_request_cm_notification
2006-05-22  Matthias Clasen  <mclasen@redhat.com>

	* gdk/x11/gdkscreen-x11.c: Remove _gdk_x11_screen_request_cm_notification

	* gdk/x11/gdkdisplay-x11.c (gdk_display_open): Directly call
	gdk_display_request_selection_notification.

	* gdk/x11/gdkdisplay-x11.c: Several cleanups.
2006-05-22 04:11:42 +00:00
Matthias Clasen
f22387f042 Remove extraneous ; 2006-05-14 03:58:06 +00:00
Matthias Clasen
059292a765 fix build without xfixes 2006-04-27 05:04:49 +00:00
Søren Sandmann
b9d1a03440 Create 'composited' label.
Tue Apr 25 10:25:28 2006  Søren Sandmann  <sandmann@redhat.com>

	* tests/testgtk.c (create_alpha_window): Create 'composited' label.

	* tests/testgtk.c (on_composited_changed): New function, change
	the label to say whether the screen is composited or not.

	* gtk/gtkwindow.c (gtk_window_on_composited_changed): When
	composited status change, invalidate the window and propagate the signal;.

	* gtk/gtkwindow.c (gtk_window_map): Set the appropriate type hint
	if reset_type_hint is TRUE.

	* gtk/gtkwindow.c (gtk_window_set_type_hint): If hint is one of
	the old hints, store a shadow copy in the public window->type_hint
	bitfield, otherwise set this field to normal. Set the private
	field to the type hint.

	* gtk/gtkwindow.c (gtk_window_init): Initialize priv->type_hint.

	* gtk/gtkwindow.c (struct _GtkWindowPrivate): New field
	"reset_type_hint" indicating whether the type hint needs to be
	reset. New field type_hint containing a GdkWindowTypeHint.

	* gtk/gtkwidget.c (propagate_composited_changed): New function to
	propagate changes in composited status.
	(gtk_widget_class_init): Add composited_changed signal.

	* gtk/gtkwidget.h (struct _GtkWidgetClass): New signal composited-changed.

	* gtk/gtkwidget.c (gtk_widget_is_composited): New function.

	* gtk/gtktooltips.c (gtk_tooltips_draw_tips): Set transient for.

	* gtk/gtktooltips.c (gtk_tooltips_force_window): Set the type hint

	* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Compute whether
	the item belongs to a menubar. Set the type_hint appropriately
	depending on the outcome.

	* gtk/gtkmenu.c (gtk_menu_position): Set the default type hint here.

	* gtk/gtkmenu.c (gtk_menu_attach_to_widget): connect to hierarchy
	changed on the attach widget.

	* gtk/gtkmenu.c (attach_widget_hierarchy_changed): New function to
	set the transient_for property for menus.

	* gtk/gtkdnd.c (set_icon_stock_pixbuf): Set the appropriate type hint.

	* gtk/gtkcombo.c (gtk_combo_popup_list): Make the popup window
	transient for the toplevel.

	* gtk/gtkcombobox.c (gtk_combo_box_set_popup_widget): Set
	transient-for, for the popup window.

	* gdk/x11/gdkwindow-x11.c (gdk_window_get_type_hint): Support for
	new window types.

	* gdk/x11/gdkwindow-x11.c (gdk_window_set_type_hint): Add support
	for new window types.

	* gdk/x11/gdkscreen-x11.c (_gdk_x11_screen_process_owner_change):
	New function called whenever the compositing manager comes and goes.

	* gdk/x11/gdkscreen-x11.c (gdk_screen_is_composited): New function.

	* gdk/x11/gdkscreen-x11.c
	(_gdk_x11_screen_request_cm_notification, make_cm_atom,
	check_is_composited): New functions

	* gdk/x11/gdkevents-x11.c (gdk_event_translate): Call
	_gdk_x11_screen_process_owner_change when an
	XFixesSelectionNotifyEvent is received.

	* gdk/x11/gdkdisplay-x11.c (gdk_display_open): Call
	_gdk_x11_screen_request_cm_notification() on all screens.

	* gdk/quartz/gdkscreen-quartz.c (gdk_screen_is_composited): Dummy
	implementation.

	* gdk/gdkscreen.c (gdk_screen_class_init): New signal,
	'composited-changed'.

	* gdk/gdkwindow.h: Add new EWMH window types.

	* gdk/win32/gdkscreen-win32.c (gdk_screen_is_composited)
2006-04-25 14:27:32 +00:00
Matthias Clasen
10f0736ac7 Use G_DEFINE_TYPE.
2006-04-04  Matthias Clasen  <mclasen@redhat.com>

	* gdk/gdkdisplay.c:
	* gdk/gdkdisplaymanager.c:
	* gdk/gdkdraw.c:
	* gdk/gdkkeys.c:
	* gdk/gdkpixmap.c:
	* gdk/gdkscreen.c:
	* gdk/gdkwindow.c:
	* gdk/x11/gdkcolor-x11.c:
	* gdk/x11/gdkdisplay-x11.c:
	* gdk/x11/gdkdnd-x11.c:
	* gdk/x11/gdkdrawable-x11.c:
	* gdk/x11/gdkgc-x11.c:
	* gdk/x11/gdkimage-x11.c:
	* gdk/x11/gdkinput.c:
	* gdk/x11/gdkpixmap-x11.c:
	* gdk/x11/gdkscreen-x11.c:
	* gdk/x11/gdkwindow-x11.c: Use G_DEFINE_TYPE.

	* gdk/x11/gdkcolor-x11.c:
	* gdk/x11/gdkdnd-x11.c:
	* gdk/x11/gdkimage-x11.c: Use instance private data.
2006-04-04 14:02:03 +00:00
Michael Natterer
5afb4f0f11 gdk/gdkscreen.h gdk/x11/gdkscreen-x11.c added
2006-03-08  Michael Natterer  <mitch@imendio.com>

	* gdk/gdkscreen.h
	* gdk/x11/gdkscreen-x11.c
	* gdk/gdk.symbols: added gdk_screen_get_active_window() and
	gdk_screen_get_window_stack() (patch from maemo-gtk).
	Fixes bug #320881.

	* gdk/directfb/gdkscreen-directfb.c
	* gdk/quartz/gdkscreen-quartz.c
	* gdk/win32/gdkscreen-win32.c: added the functions as stubs.
2006-03-08 17:02:34 +00:00
Michael Natterer
8bdc0bf97c Applied patch from maemo-gtk that addresses many issues wrt display
2005-11-10  Michael Natterer  <mitch@imendio.com>

	Applied patch from maemo-gtk that addresses many issues wrt
	display migration and display closing (bug #85715).

	* gdk/gdkdisplay.c (gdk_display_dispose): don't just set the
	default display to NULL when it's closed. Instead set the most
	recently opened display as new default (if one exists).

	* gdk/gdkpango.c (on_renderer_display_closed): fixed signature
	of this callback.

	* gdk/gdkscreen.c (gdk_screen_dispose): check if the GCs still
	exist before unrefing them.

	* gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): if the screen
	is closed, allow destruction of the root window.

	* gdk/x11/gdkdisplay-x11.c: moved some stuff from finalize() to
	dispose(), free stuff that was leaked before.

	* gdk/x11/gdkevents-x11.c (_gdk_x11_events_uninit_screen): check if
	the xsettings_client still exists before destroying it.

	* gdk/x11/gdkkeys-x11.c: added finalization and free the allocated
	X resources.

	* gdk/x11/gdkpixmap-x11.c: moved stuff from finalize() to new
	dispose() implementation.

	* gdk/x11/gdkscreen-x11.c: moved stuff from finalize() to
	dispose() and check if it still exists before unrefing it. Set
	their pointers to NULL/None *after* upchaining in dispose(),
	because X11 implementations of members of the parent class still
	need them for their own destruction.

	* gdk/x11/gdkvisual-x11.c: removed finalize() implementation which
	was g_error()ing when finalizing a visual.

	* gtk/gtkclipboard.c (gtk_clipboard_finalize): don't use
	get_clipboard_widget() because it would create the widget if it
	doesn't exist. Use g_object_get_data() directly instead.

	* gtk/gtktextdisplay.c (on_renderer_display_closed): fixed signature
	of this callback.
2005-11-10 12:09:42 +00:00
Matthias Clasen
94eec04267 Intern some more strings.
2005-09-01  Matthias Clasen  <mclasen@redhat.com>

        * gdk/*.c: Intern some more strings.
        * gtk/gtkintl.h:
        * gtk/*.c: Define an I_() macro and use it instead of the
        bulky g_intern_static_string().
2005-09-01 05:11:46 +00:00
Matthias Clasen
476e138db0 Intern type names before registering the type to avoid unnecessary copies.
2005-08-31  Matthias Clasen  <mclasen@redhat.com>

	* gdk/x11/gdkwindow-x11.c (gdk_window_impl_x11_get_type):
	* gdk/x11/gdkscreen-x11.c (_gdk_screen_x11_get_type):
	* gdk/x11/gdkpixmap-x11.c (gdk_pixmap_impl_x11_get_type):
	* gdk/x11/gdkkeys-x11.c (gdk_keymap_x11_get_type):
	* gdk/x11/gdkinput.c (gdk_device_get_type):
	* gdk/x11/gdkimage-x11.c (gdk_image_get_type):
	* gdk/x11/gdkgc-x11.c (_gdk_gc_x11_get_type):
	* gdk/x11/gdkdrawable-x11.c (_gdk_drawable_impl_x11_get_type):
	* gdk/x11/gdkdnd-x11.c (gdk_drag_context_get_type):
	* gdk/x11/gdkdisplay-x11.c (_gdk_display_x11_get_type):
	* gdk/x11/gdkcolor-x11.c (gdk_colormap_get_type):
	* gdk/gdkwindow.c (gdk_window_object_get_type):
	* gdk/gdkscreen.c (gdk_screen_get_type):
	* gdk/gdkrectangle.c (gdk_rectangle_get_type):
	* gdk/gdkpixmap.c (gdk_pixmap_get_type):
	* gdk/gdkkeys.c (gdk_keymap_get_type):
	* gdk/gdkfont.c (gdk_font_get_type):
	* gdk/gdkevents.c (gdk_event_get_type):
	* gdk/gdkdraw.c (gdk_drawable_get_type):
	* gdk/gdkdisplaymanager.c (gdk_display_manager_get_type):
	* gdk/gdkdisplay.c (gdk_display_get_type):
	* gdk/gdkcursor.c (gdk_cursor_get_type):
	* gdk/gdkcolor.c (gdk_color_get_type): Intern type names before
	registering the type to avoid unnecessary copies.
2005-08-31 15:14:26 +00:00
Owen Taylor
485fd85179 Fill in unused bits so they can be used for the depth-32 target case.
2005-05-09  Owen Taylor  <otaylor@redhat.com>

        * gdk/gdkrgb.c (gdk_rgb_convert_0888_br, gdk_rgb_convert_8880_br):
        Fill in unused bits so they can be used for the depth-32 target case.
        Rewrite so that that gives a marginal speedup rather than a
        marginal slowdown. (on x86)

        * gdk/gdkscreen.h gdk/x11/gdkscreen-x11.[ch] gdk/x11/gdkvisual-x11.c:
        Add gdk_screen_get_rgba_colormap/visual to get a visual for
        windows with an alpha channel, if one exists.

        * gdk/win32/gdkscreen-win32.c gdk/linux-fb/gdkscreen-fb.c:
        Stub out gdk_screen_get_rgba_colormap/visual.

        * gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors): computation of
        "unused" wasn't right for depth == 32, since it depended on
        shifting by 32.

        * gdk/gdkrgb.c: Fill in alpha bits with 1s. (Based on patch from
        Keith Packard,
        http://mail.gnome.org/archives/gtk-devel-list/2004-June/msg00080.html)

        * gdk/x11/gdkdrawable-x11.c (gdk_x11_drawable_get_picture):
        Implement again, without using Xft.

        * tests/testgtk.c: Add a test for windows with an alpha channel.
2005-05-09 22:54:10 +00:00
Matthias Clasen
65903c3ae7 Fix typos in the docs. (#303389, Masao Mutoh)
2005-05-07  Matthias Clasen  <mclasen@redhat.com>

	* gdk/x11/gdkscreen-x11.c (gdk_screen_get_width_mm)
	(gdk_screen_get_height_mm): Fix typos in the docs.  (#303389,
	Masao Mutoh)
2005-05-08 03:18:09 +00:00