fix: Fix secondary screen highlight display anomaly in 90° and 270° rotation#3178
fix: Fix secondary screen highlight display anomaly in 90° and 270° rotation#3178leibn123 wants to merge 1 commit intolinuxdeepin:masterfrom
Conversation
…otation 1.修改副屏旋转90度和270度的高亮显示异常问题 PMS: BUG-355449
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: leibn123 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @leibn123. Thanks for your PR. I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Reviewer's GuideAdjusts how the selected/highlighted display is determined and rendered, particularly for rotated secondary screens, and preserves the last selected screen across virtual screen updates so that highlighting and indicator placement remain correct after rotation or configuration changes. Sequence diagram for screen selection and highlight/indicator updatesequenceDiagram
actor User
participant DisplayMain as DisplayMain_qml
participant ScreenItem as ScreenItem_qml
participant dccData
participant QtScreens as Qt_application_screens
participant Indicator as indicator_component
User->>ScreenItem: click()
ScreenItem->>DisplayMain: onPressed / onScreenClicked(screen)
DisplayMain->>DisplayMain: set root.screen = screen
DisplayMain->>DisplayMain: set lastScreenName = screen.name
alt dccData.isX11
DisplayMain->>DisplayMain: getQtScreen(screen)
loop for_each_s_in_Qt_application_screens
DisplayMain->>QtScreens: read s.virtualX, s.virtualY, s.width, s.height, s.devicePixelRatio
DisplayMain->>DisplayMain: isRotated = (screen.rotate == 2 || screen.rotate == 8)
DisplayMain->>DisplayMain: targetW = isRotated ? screen.currentResolution.height : screen.currentResolution.width
DisplayMain->>DisplayMain: targetH = isRotated ? screen.currentResolution.width : screen.currentResolution.height
alt match_position_and_size
DisplayMain-->>DisplayMain: return s
end
end
DisplayMain-->>Indicator: createObject(parent, screen = matched_s)
else not dccData.isX11
DisplayMain-->>DisplayMain: no indicator created
end
DisplayMain->>ScreenItem: selected = (root.screen === item.screen && screen.rotate !== undefined)
ScreenItem->>ScreenItem: Loader.active = selected
ScreenItem->>ScreenItem: Loader.visible = selected
Class diagram for updated display selection and highlighting logicclassDiagram
class DisplayMain_qml {
+var screen
+string lastScreenName
+var activeDialogs
+var scaleModelConst
+getQtScreen(screen)
+getControlCenterScreen()
+closeInvalidDialogs()
+onVirtualScreensChanged()
}
class ScreenItem_qml {
+var screen
+bool selected
+real translationX
+real translationY
+real scale
+Loader highlightLoader
}
class ScreenTabDelegate_qml {
+var modelData
+var screen
+bool isSelect
+bool hovered
}
class DccData {
+var virtualScreens
+bool isX11
}
class Indicator_component {
+createObject(parent, screen)
}
DisplayMain_qml --> DccData : uses_virtualScreens
DisplayMain_qml --> ScreenItem_qml : manages_selection
DisplayMain_qml --> ScreenTabDelegate_qml : binds_screen_property
DisplayMain_qml --> Indicator_component : creates_indicator
ScreenItem_qml o-- DisplayMain_qml : root_reference
ScreenItem_qml : Loader.active = selected
ScreenItem_qml : Loader.visible = selected
ScreenTabDelegate_qml : isSelect = modelData.name == screen.name
Flow diagram for rotation-aware getQtScreen matchingflowchart TD
A["Start getQtScreen(screen)"] --> B[Initialize matchedScreen to null]
B --> C{Are there Qt application screens?}
C -->|no| Z[Return null]
C -->|yes| D[Iterate s over Qt.application.screens]
D --> E[Compute isRotated = screen.rotate == 2 or screen.rotate == 8]
E --> F["If isRotated: targetW = screen.currentResolution.height<br>else: targetW = screen.currentResolution.width"]
F --> G["If isRotated: targetH = screen.currentResolution.width<br>else: targetH = screen.currentResolution.height"]
G --> H["Position and size match?<br>(s.virtualX == screen.x<br>and s.virtualY == screen.y<br>and abs(s.width * s.devicePixelRatio - targetW) < 1<br>and abs(s.height * s.devicePixelRatio - targetH) < 1)"]
H -->|yes| I[matchedScreen = s]
I --> J[Return matchedScreen]
H -->|no| K{More screens?}
K -->|yes| D
K -->|no| Z[Return null]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
onVirtualScreensChanged,lastScreenNameis not updated whenroot.screenis reassigned (either to the matched screen or the first screen), which means subsequent changes may no longer track the actually selected screen; consider updatinglastScreenNamewheneverroot.screenchanges or centralizing that logic in anonScreenChangedhandler. - In
ScreenTab.qml, the temporary variablesmodelNameandscreenNameinside theisSelectproperty are computed but never used; they can be removed to simplify the binding and avoid confusion.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `onVirtualScreensChanged`, `lastScreenName` is not updated when `root.screen` is reassigned (either to the matched screen or the first screen), which means subsequent changes may no longer track the actually selected screen; consider updating `lastScreenName` whenever `root.screen` changes or centralizing that logic in an `onScreenChanged` handler.
- In `ScreenTab.qml`, the temporary variables `modelName` and `screenName` inside the `isSelect` property are computed but never used; they can be removed to simplify the binding and avoid confusion.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
TAG Bot New tag: 6.1.82 |
|
TAG Bot New tag: 6.1.83 |
1.修改副屏旋转90度和270度的高亮显示异常问题
PMS: BUG-355449
Summary by Sourcery
Fix secondary display highlight behavior and screen selection persistence when displays are rotated.
Bug Fixes:
Enhancements: