Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(542)

Side by Side Diff: app/x11_util.cc

Issue 2068004: Commiting http://codereview.chromium.org/2017007/show on behalf of rkc@chromi... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/mac_util.h » ('j') | chrome/chrome_browser.gypi » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file defines utility functions for X11 (Linux only). This code has been 5 // This file defines utility functions for X11 (Linux only). This code has been
6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support 6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support
7 // remains woefully incomplete. 7 // remains woefully incomplete.
8 8
9 #include "app/x11_util.h" 9 #include "app/x11_util.h"
10 10
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 memcpy(&(*png_representation)[old_size], data, length); 729 memcpy(&(*png_representation)[old_size], data, length);
730 return CAIRO_STATUS_SUCCESS; 730 return CAIRO_STATUS_SUCCESS;
731 } 731 }
732 732
733 void GrabWindowSnapshot(GtkWindow* gtk_window, 733 void GrabWindowSnapshot(GtkWindow* gtk_window,
734 std::vector<unsigned char>* png_representation) { 734 std::vector<unsigned char>* png_representation) {
735 GdkWindow* gdk_window = GTK_WIDGET(gtk_window)->window; 735 GdkWindow* gdk_window = GTK_WIDGET(gtk_window)->window;
736 Display* display = GDK_WINDOW_XDISPLAY(gdk_window); 736 Display* display = GDK_WINDOW_XDISPLAY(gdk_window);
737 XID win = GDK_WINDOW_XID(gdk_window); 737 XID win = GDK_WINDOW_XID(gdk_window);
738 XWindowAttributes attr; 738 XWindowAttributes attr;
739 if (XGetWindowAttributes(display, win, &attr) != 0) { 739 if (XGetWindowAttributes(display, win, &attr) == 0) {
740 LOG(ERROR) << "Couldn't get window attributes"; 740 LOG(ERROR) << "Couldn't get window attributes";
741 return; 741 return;
742 } 742 }
743 XImage* image = XGetImage( 743 XImage* image = XGetImage(
744 display, win, 0, 0, attr.width, attr.height, AllPlanes, ZPixmap); 744 display, win, 0, 0, attr.width, attr.height, AllPlanes, ZPixmap);
745 if (!image) { 745 if (!image) {
746 LOG(ERROR) << "Couldn't get image"; 746 LOG(ERROR) << "Couldn't get image";
747 return; 747 return;
748 } 748 }
749 if (image->depth != 24) { 749 if (image->depth != 24) {
(...skipping 30 matching lines...) Expand all
780 event.xclient.format = 32; 780 event.xclient.format = 32;
781 event.xclient.data.l[0] = desktop; 781 event.xclient.data.l[0] = desktop;
782 event.xclient.data.l[1] = 1; // source indication 782 event.xclient.data.l[1] = 1; // source indication
783 783
784 int result = XSendEvent(GetXDisplay(), GetX11RootWindow(), False, 784 int result = XSendEvent(GetXDisplay(), GetX11RootWindow(), False,
785 SubstructureNotifyMask, &event); 785 SubstructureNotifyMask, &event);
786 return result == Success; 786 return result == Success;
787 } 787 }
788 788
789 } // namespace x11_util 789 } // namespace x11_util
OLDNEW
« no previous file with comments | « no previous file | base/mac_util.h » ('j') | chrome/chrome_browser.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698