| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2010 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 #include "webrtc/base/macwindowpicker.h" | 10 #include "webrtc/base/macwindowpicker.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 if (!RunAppleScript(ss.str())) { | 153 if (!RunAppleScript(ss.str())) { |
| 154 // This might happen to for example X applications where the X | 154 // This might happen to for example X applications where the X |
| 155 // server spawns of processes with their own PID but the X server | 155 // server spawns of processes with their own PID but the X server |
| 156 // is still registered as owner to the application windows. As a | 156 // is still registered as owner to the application windows. As a |
| 157 // workaround, we put the X server process to front, meaning that | 157 // workaround, we put the X server process to front, meaning that |
| 158 // all X applications will show up. The drawback with this | 158 // all X applications will show up. The drawback with this |
| 159 // workaround is that the application that we really wanted to set | 159 // workaround is that the application that we really wanted to set |
| 160 // to front might be behind another X application. | 160 // to front might be behind another X application. |
| 161 ProcessSerialNumber psn; | 161 ProcessSerialNumber psn; |
| 162 pid_t pid = pid_val; | 162 pid_t pid = pid_val; |
| 163 // TODO(hjon): Update deprecated APIs (see webrtc:5478 for details). |
| 164 #pragma clang diagnostic push |
| 165 #pragma clang diagnostic ignored "-Wdeprecated" |
| 163 int res = GetProcessForPID(pid, &psn); | 166 int res = GetProcessForPID(pid, &psn); |
| 164 if (res != 0) { | 167 if (res != 0) { |
| 165 LOG(LS_ERROR) << "Failed getting process for pid"; | 168 LOG(LS_ERROR) << "Failed getting process for pid"; |
| 166 result = false; | 169 result = false; |
| 167 } | 170 } |
| 168 res = SetFrontProcess(&psn); | 171 res = SetFrontProcess(&psn); |
| 169 if (res != 0) { | 172 if (res != 0) { |
| 170 LOG(LS_ERROR) << "Failed setting process to front"; | 173 LOG(LS_ERROR) << "Failed setting process to front"; |
| 171 result = false; | 174 result = false; |
| 172 } | 175 } |
| 176 #pragma clang diagnostic pop |
| 173 } | 177 } |
| 174 CFRelease(window_id_array); | 178 CFRelease(window_id_array); |
| 175 CFRelease(window_array); | 179 CFRelease(window_array); |
| 176 return result; | 180 return result; |
| 177 } | 181 } |
| 178 | 182 |
| 179 bool MacWindowPicker::GetDesktopList(DesktopDescriptionList* descriptions) { | 183 bool MacWindowPicker::GetDesktopList(DesktopDescriptionList* descriptions) { |
| 180 const uint32_t kMaxDisplays = 128; | 184 const uint32_t kMaxDisplays = 128; |
| 181 CGDirectDisplayID active_displays[kMaxDisplays]; | 185 CGDirectDisplayID active_displays[kMaxDisplays]; |
| 182 uint32_t display_count = 0; | 186 uint32_t display_count = 0; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 descriptions->push_back(desc); | 251 descriptions->push_back(desc); |
| 248 } | 252 } |
| 249 } | 253 } |
| 250 } | 254 } |
| 251 | 255 |
| 252 CFRelease(window_array); | 256 CFRelease(window_array); |
| 253 return true; | 257 return true; |
| 254 } | 258 } |
| 255 | 259 |
| 256 } // namespace rtc | 260 } // namespace rtc |
| OLD | NEW |