Question on call to XChangeProperty

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Question on call to XChangeProperty

Postby Mayhew » Fri Oct 10, 2014 7:12 pm

I'm just curious why this code in cefclient_gtk.cpp
// Set the hidden property state value.
scoped_ptr<Atom[]> data(new Atom[1]);
data[0] = atoms[2];

XChangeProperty(xdisplay,
xwindow,
atoms[0], // name
atoms[1], // type
32, // size in bits of items in 'value'
PropModeReplace,
reinterpret_cast<const unsigned char*>(data.get()),
1); // num items

Cannot simply be
XChangeProperty(xdisplay, xwindow, atoms[0], atoms[1], 32,
PropModeReplace,
reinterpret_cast<const unsigned char*>(&(atoms[2])), 1);

It seems like the scoped_ptr usage is unnecessary. Is there something I am missing?
Mayhew
Expert
 
Posts: 303
Joined: Mon Apr 18, 2011 8:02 pm

Re: Question on call to XChangeProperty

Postby magreenblatt » Fri Oct 10, 2014 7:18 pm

Mayhew wrote:Is there something I am missing?

Your version is fine too but I think the original code is somewhat more readable.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 114 guests