@@ -608,31 +608,38 @@ namespace pipewire {
608608 * @brief Verify and update display parameters for logical dimensions, desktop dimensions and logical desktop dimensions (default is adapted from wlgrab)
609609 */
610610 virtual void verify_and_update_display_parameters () {
611- // Set environment dimensions to stream dimensions (unless we find something better to report here)
612- if (env_height <= 0 || env_width <= 0 ) {
613- this ->env_width = width;
614- this ->env_height = height;
615- BOOST_LOG (debug) << " [pipewire] Desktop Resolution: " sv << env_width << ' x' << env_height;
616- }
617- // Query logical sizes directly using wayland wl::monitors() and match current screen based on offset/dimensions
618- if (logical_height <= 0 || logical_width <= 0 || env_logical_height <= 0 || env_logical_width <= 0 ) {
611+ // Query outputs directly using wayland wl::monitors()
612+ if (logical_height <= 0 || logical_width <= 0 || env_logical_height <= 0 || env_logical_width <= 0 || env_height <= 0 || env_width <= 0 ) {
613+ int desktop_width = 0 ;
614+ int desktop_height = 0 ;
619615 int desktop_logical_width = 0 ;
620616 int desktop_logical_height = 0 ;
621617 for (const auto &monitor : wl::monitors ()) {
622- // If logical_width and logical_height are not valid try to update them to correct values by matching to monitor position/dimension or position/logical dimensions
623- // since we're iterating for maximum environment size anyway
618+ BOOST_LOG (debug) << " [pipewire] Found output: '" sv << monitor->name << " ' offset: " sv << monitor->viewport .offset_x << ' x' << monitor->viewport .offset_y << " resolution: " sv << monitor->viewport .width << ' x' << monitor->viewport .height << " logical resolution: " sv << monitor->viewport .logical_width << ' x' << monitor->viewport .logical_height ;
619+ // If logical_width and logical_height are not valid try to update them to correct values by matching to monitor
620+ // position/dimension or position/logical dimensions here since we're iterating for maximum environment size anyway
624621 if ((logical_width <= 0 || logical_height <= 0 ) && monitor->viewport .offset_x == offset_x && monitor->viewport .offset_y == offset_y && ((monitor->viewport .width == width && monitor->viewport .height == height) || (monitor->viewport .logical_width == width && monitor->viewport .logical_height == height))) {
625622 this ->logical_width = monitor->viewport .logical_width ;
626623 this ->logical_height = monitor->viewport .logical_height ;
627- BOOST_LOG (debug) << " [pipewire] Logical Resolution : " sv << logical_width << ' x' << logical_height;
624+ BOOST_LOG (debug) << " [pipewire] Set logical resolution : " sv << logical_width << ' x' << logical_height;
628625 }
629- // Update logical dimensions to setup maximum environment size over all screens
626+ // Update desktop dimensions to setup maximum environment size over all screens
627+ desktop_width = std::max (desktop_width, monitor->viewport .offset_x + monitor->viewport .width );
628+ desktop_height = std::max (desktop_height, monitor->viewport .offset_y + monitor->viewport .height );
629+ // Update desktop logical dimensions to setup maximum logical environment size over all screens
630630 desktop_logical_width = std::max (desktop_logical_width, monitor->viewport .offset_x + monitor->viewport .logical_width );
631631 desktop_logical_height = std::max (desktop_logical_height, monitor->viewport .offset_y + monitor->viewport .logical_height );
632632 }
633- this ->env_logical_width = std::max (env_logical_width, desktop_logical_width);
634- this ->env_logical_height = std::max (env_logical_height, desktop_logical_height);
635- BOOST_LOG (debug) << " [pipewire] Logical Desktop Resolution: " sv << env_logical_width << ' x' << env_logical_height;
633+ if (env_height <= 0 || env_width <= 0 ) {
634+ this ->env_width = desktop_width;
635+ this ->env_height = desktop_height;
636+ BOOST_LOG (debug) << " [pipewire] Set desktop resolution: " sv << env_width << ' x' << env_height;
637+ }
638+ if (env_logical_height <= 0 || env_logical_width <= 0 ) {
639+ this ->env_logical_width = desktop_logical_width;
640+ this ->env_logical_height = desktop_logical_height;
641+ BOOST_LOG (debug) << " [pipewire] Set desktop logical resolution: " sv << env_logical_width << ' x' << env_logical_height;
642+ }
636643 }
637644 }
638645
@@ -662,7 +669,7 @@ namespace pipewire {
662669 BOOST_LOG (error) << " [pipewire] Could not find display with name: '" sv << display_name << " '" ;
663670 return -1 ;
664671 }
665- BOOST_LOG (info) << " [pipewire] Streaming display '" sv << display_name << " ' from position : " sv << offset_x << " x" sv << offset_y << " resolution: " sv << width << " x" sv << height;
672+ BOOST_LOG (info) << " [pipewire] Streaming display '" sv << display_name << " ' offset : " sv << offset_x << " x" sv << offset_y << " resolution: " sv << width << " x" sv << height;
666673
667674 // Verify or update display parameters for streaming to ensure absolute touch inputs work as expected
668675 verify_and_update_display_parameters ();
0 commit comments